Removed buffer damage tracking in client, let UWAC handle that.

This commit is contained in:
Armin Novak 2019-01-24 12:01:40 +01:00
parent 0cf898e722
commit 86e20d7647
2 changed files with 8 additions and 29 deletions

View File

@ -40,21 +40,6 @@
#include "wlf_disp.h" #include "wlf_disp.h"
#include "wlf_channels.h" #include "wlf_channels.h"
static BOOL wl_update_content(wlfContext* context_w)
{
if (!context_w)
return FALSE;
if (!context_w->waitingFrameDone && context_w->haveDamage)
{
UwacWindowSubmitBuffer(context_w->window, true);
context_w->waitingFrameDone = TRUE;
context_w->haveDamage = FALSE;
}
return TRUE;
}
static BOOL wl_begin_paint(rdpContext* context) static BOOL wl_begin_paint(rdpContext* context)
{ {
rdpGdi* gdi; rdpGdi* gdi;
@ -75,6 +60,7 @@ static BOOL wl_update_buffer(wlfContext* context_w, INT32 ix, INT32 iy, INT32 iw
{ {
rdpGdi* gdi; rdpGdi* gdi;
char* data; char* data;
size_t baseOffset;
UINT32 i, x, y, w, h; UINT32 i, x, y, w, h;
if (!context_w) if (!context_w)
@ -97,9 +83,10 @@ static BOOL wl_update_buffer(wlfContext* context_w, INT32 ix, INT32 iy, INT32 iw
if (!gdi) if (!gdi)
return FALSE; return FALSE;
baseOffset = y * gdi->stride + x * GetBytesPerPixel(gdi->dstFormat);
for (i = 0; i < h; i++) for (i = 0; i < h; i++)
{ {
size_t offset = (i + y) * gdi->stride + x * GetBytesPerPixel(gdi->dstFormat); size_t offset = i * gdi->stride + baseOffset;
memcpy(data + offset, gdi->primary_buffer + offset, memcpy(data + offset, gdi->primary_buffer + offset,
w * GetBytesPerPixel(gdi->dstFormat)); w * GetBytesPerPixel(gdi->dstFormat));
} }
@ -107,8 +94,10 @@ static BOOL wl_update_buffer(wlfContext* context_w, INT32 ix, INT32 iy, INT32 iw
if (UwacWindowAddDamage(context_w->window, x, y, w, h) != UWAC_SUCCESS) if (UwacWindowAddDamage(context_w->window, x, y, w, h) != UWAC_SUCCESS)
return FALSE; return FALSE;
context_w->haveDamage = TRUE; if (UwacWindowSubmitBuffer(context_w->window, true) != UWAC_SUCCESS)
return wl_update_content(context_w); return FALSE;
return TRUE;
} }
static BOOL wl_end_paint(rdpContext* context) static BOOL wl_end_paint(rdpContext* context)
@ -245,7 +234,7 @@ static BOOL wl_post_connect(freerdp* instance)
if (!context->clipboard) if (!context->clipboard)
return FALSE; return FALSE;
return wl_update_buffer(context, 0, 0, gdi->width, gdi->height); return wl_refresh_display(context);
} }
static void wl_post_disconnect(freerdp* instance) static void wl_post_disconnect(freerdp* instance)
@ -286,14 +275,6 @@ static BOOL handle_uwac_events(freerdp* instance, UwacDisplay* display)
switch (event.type) switch (event.type)
{ {
case UWAC_EVENT_FRAME_DONE: case UWAC_EVENT_FRAME_DONE:
if (!instance)
continue;
context->waitingFrameDone = FALSE;
if (context->haveDamage && !wl_update_content(context))
return FALSE;
break; break;
case UWAC_EVENT_POINTER_ENTER: case UWAC_EVENT_POINTER_ENTER:

View File

@ -42,8 +42,6 @@ struct wlf_context
HANDLE displayHandle; HANDLE displayHandle;
UwacWindow* window; UwacWindow* window;
BOOL waitingFrameDone;
BOOL haveDamage;
BOOL fullscreen; BOOL fullscreen;
/* Channels */ /* Channels */