[client] egl: use new EGL damage count semantics

After the damage queue PR, EGL damage count 0 means no change, and -1 means
invalidate the entire window. However, several other places have different
semantics, and we are not handling them correctly:

1. KVMFR uses 0 to signal invalidating the entire frame, so if we receive 0
   rectangles in egl_on_frame, we should set damage count to -1.
2. The damage overlay treated 0 as full damage, which is now incorrect. This
   is fixed, and now it treats 0 as no update, and -1 as full damage.
This commit is contained in:
Quantum 2021-08-01 21:01:24 -04:00 committed by Geoffrey McRae
parent 8d78a5aa95
commit 5d5e4ede1a
2 changed files with 4 additions and 3 deletions

View File

@ -190,11 +190,11 @@ bool egl_damage_render(EGL_Damage * damage, bool rotate, const struct DesktopDam
egl_shader_use(damage->shader);
glUniformMatrix3x2fv(damage->uTransform, 1, GL_FALSE, damage->transform);
if (data)
if (data && data->count != 0)
{
damage->count = data->count;
GLfloat vertices[KVMFR_MAX_DAMAGE_RECTS * 8];
if (damage->count == 0)
if (damage->count == -1)
{
FrameDamageRect full = {
.x = 0, .y = 0, .width = damage->width, .height = damage->height,

View File

@ -514,7 +514,8 @@ static bool egl_on_frame(void * opaque, const FrameBuffer * frame, int dmaFd,
INTERLOCKED_SECTION(this->desktopDamageLock, {
struct DesktopDamage * damage = this->desktopDamage + this->desktopDamageIdx;
if (damage->count == -1 || damage->count + damageRectsCount >= KVMFR_MAX_DAMAGE_RECTS)
if (damage->count == -1 || damageRectsCount == 0 ||
damage->count + damageRectsCount >= KVMFR_MAX_DAMAGE_RECTS)
damage->count = -1;
else
{