Only acknowledge frame_done once per commit, otherwise we pull unwanted

frames out of thin air.

Also use dummy ClientMessage events to nudge steamcompmgr's event loop,
Expose events have a meaning and we don't want to confuse some clients.
This commit is contained in:
Pierre-Loup A. Griffais 2019-11-24 13:55:02 -08:00 committed by Pierre-Loup A. Griffais
parent 985d6e40a7
commit a58dfdd203
4 changed files with 20 additions and 15 deletions

View file

@ -121,7 +121,7 @@ void wayland_PushSurface(struct wlr_surface *surf, struct wlr_dmabuf_attributes
g_vecResListEntries.push_back( newEntry ); g_vecResListEntries.push_back( newEntry );
} }
send_xwayland_expose(); nudge_steamcompmgr();
} }
int steamCompMgr_PullSurface( struct ResListEntry_t *pResEntry ) int steamCompMgr_PullSurface( struct ResListEntry_t *pResEntry )

View file

@ -98,6 +98,7 @@ typedef struct _win {
Bool nudged; Bool nudged;
Bool ignoreOverrideRedirect; Bool ignoreOverrideRedirect;
Bool validContents; Bool validContents;
Bool committed;
Bool mouseMoved; Bool mouseMoved;
@ -127,7 +128,7 @@ static Window currentOverlayWindow;
static Window currentNotificationWindow; static Window currentNotificationWindow;
static Window ourWindow; static Window ourWindow;
static XEvent exposeEvent; static XEvent nudgeEvent;
Bool gameFocused; Bool gameFocused;
@ -1244,6 +1245,7 @@ add_win (Display *dpy, Window id, Window prev, unsigned long sequence)
} }
new->damaged = 0; new->damaged = 0;
new->validContents = False; new->validContents = False;
new->committed = False;
new->texName = 0; new->texName = 0;
new->eglImage = EGL_NO_IMAGE_KHR; new->eglImage = EGL_NO_IMAGE_KHR;
@ -1571,10 +1573,9 @@ register_cm (Display *dpy)
ourWindow = w; ourWindow = w;
exposeEvent.type = Expose; nudgeEvent.xclient.type = ClientMessage;
exposeEvent.xexpose.window = ourWindow; nudgeEvent.xclient.window = ourWindow;
exposeEvent.xexpose.width = 1; nudgeEvent.xclient.format = 32;
exposeEvent.xexpose.height = 1;
return True; return True;
} }
@ -1603,6 +1604,8 @@ void check_new_wayland_res(void)
w->damaged = 1; w->damaged = 1;
w->validContents = True; w->validContents = True;
w->committed = True;
bFound = True; bFound = True;
} }
} }
@ -2050,7 +2053,7 @@ steamcompmgr_main (int argc, char **argv)
// If we're in the middle of a fade, pump an event into the loop to // If we're in the middle of a fade, pump an event into the loop to
// make sure we keep pushing frames even if the app isn't updating. // make sure we keep pushing frames even if the app isn't updating.
if (fadeOutWindow.id) if (fadeOutWindow.id)
XSendEvent(dpy, ourWindow, True, ExposureMask, &exposeEvent); XSendEvent(dpy, ourWindow, True, SubstructureRedirectMask, &nudgeEvent);
Window window_returned, child; Window window_returned, child;
int root_x, root_y; int root_x, root_y;
@ -2092,9 +2095,12 @@ steamcompmgr_main (int argc, char **argv)
// Send frame done event to all Wayland surfaces // Send frame done event to all Wayland surfaces
for (win *w = list; w; w = w->next) for (win *w = list; w; w = w->next)
{ {
if ( w->wlrsurface ) if ( w->wlrsurface && w->committed == True )
{ {
// Acknowledge commit once.
wlr_surface_send_frame_done(w->wlrsurface, &now); wlr_surface_send_frame_done(w->wlrsurface, &now);
w->committed = False;
} }
} }
} }

View file

@ -20,7 +20,7 @@ struct wlserver_t wlserver;
Display *g_XWLDpy; Display *g_XWLDpy;
void send_xwayland_expose(void) void nudge_steamcompmgr(void)
{ {
static bool bHasNestedDisplay = false; static bool bHasNestedDisplay = false;
static XEvent XWLExposeEvent = {}; static XEvent XWLExposeEvent = {};
@ -29,15 +29,14 @@ void send_xwayland_expose(void)
{ {
g_XWLDpy = XOpenDisplay( wlserver.wlr.xwayland->display_name ); g_XWLDpy = XOpenDisplay( wlserver.wlr.xwayland->display_name );
XWLExposeEvent.xexpose.type = Expose; XWLExposeEvent.xclient.type = ClientMessage;
XWLExposeEvent.xexpose.window = DefaultRootWindow( g_XWLDpy ); XWLExposeEvent.xclient.window = DefaultRootWindow( g_XWLDpy );
XWLExposeEvent.xexpose.width = 1; XWLExposeEvent.xclient.format = 32;
XWLExposeEvent.xexpose.height = 1;
bHasNestedDisplay = true; bHasNestedDisplay = true;
} }
XSendEvent( g_XWLDpy , DefaultRootWindow( g_XWLDpy ), True, ExposureMask, &XWLExposeEvent); XSendEvent( g_XWLDpy , DefaultRootWindow( g_XWLDpy ), True, SubstructureRedirectMask, &XWLExposeEvent);
XFlush( g_XWLDpy ); XFlush( g_XWLDpy );
} }

View file

@ -44,7 +44,7 @@ int wlserver_init(int argc, char **argv);
int wlserver_run(void); int wlserver_run(void);
void send_xwayland_expose(void); void nudge_steamcompmgr(void);
#ifndef C_SIDE #ifndef C_SIDE
} }