Submit batch buffers from flush callback chain
PATCH 1/1 Submit batch buffers from flush callback chain
There are a few cases where the server will flush client output buffers but our block handler only catches the most common (before going into select). If the server flushes client buffers before we submit our batch buffer, the client may receive a damage event for rendering that hasn't happened yet.
Instead, we can hook into the flush callback chain, which the server will invoke just before flushing output. This lets us submit batch buffers before sending out events, preserving ordering.
Fixes 28438: [bisected] incorrect character in gnome-terminal under compiz
https://bugs.freedesktop.org/show_bug.cgi?id=28438
--- src/intel_driver.c | 33 ++++++++++++++++++++++++--------- 1 files changed, 24 insertions(+), 9 deletions(-)
src/intel_driver.c +24 -9
@@ -678,16 +678,8 @@ I830BlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) intel->BlockHandler = screen->BlockHandler; screen->BlockHandler = I830BlockHandler; -if (scrn->vtSema) { -/* Emit a flush of the rendering cache, or on the 965 and beyond -* rendering results may not hit the framebuffer until significantly -* later. -*/ -intel_batch_submit (scrn, - intel->need_mi_flush || - !list_is_empty (&intel->flush_pixmaps)); +if (scrn->vtSema == TRUE)drmCommandNone (intel->drmSubFD,DRM_I915_GEM_THROTTLE ); - }intel_uxa_block_handler (intel);intel_video_block_handler (intel);
@@ -787,6 +779,24 @@ int intel_crtc_to_pipe(xf86CrtcPtr crtc)return drmmode_get_pipe_from_crtc_id (intel->bufmgr, crtc); } +static void +intel_flush_callback (CallbackListPtr *list, +pointer user_data,pointer call_data) +{ +ScrnInfoPtr scrn = user_data; +intel_screen_private *intel =intel_get_screen_private (scrn); + +if (scrn->vtSema) { +/* Emit a flush of the rendering cache, or on the 965 +* and beyond rendering results may not hit the +* framebuffer until significantly later. +*/ +intel_batch_submit (scrn, + intel->need_mi_flush || + !list_is_empty (&intel->flush_pixmaps)); + } +} +static Bool I830ScreenInit (int scrnIndex,ScreenPtr screen,int argc,char **argv) {
@@ -955,6 +965,9 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv) intel->BlockHandler = screen->BlockHandler; screen->BlockHandler = I830BlockHandler; +if (!AddCallback (&FlushCallback, intel_flush_callback, scrn)) +return FALSE; + screen->SaveScreen = xf86SaveScreen; intel->CloseScreen = screen->CloseScreen; screen->CloseScreen = I830CloseScreen;
@@ -1114,6 +1127,8 @@ static Bool I830CloseScreen(int scrnIndex, ScreenPtr screen) intel->front_buffer =NULL ; } +DeleteCallback (&FlushCallback, intel_flush_callback, scrn); +intel_batch_teardown (scrn);if (IS_I965G (intel))
Signature · 6 lines
1.7.2 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 5 lines · Kristian Høgsberg
There are a few cases where the server will flush client output buffers but our block handler only catches the most common (before going into select). If the server flushes client buffers before we submit our batch buffer, the client may receive a damage event for rendering that hasn't happened yet.
Quoted 8 lines
Instead, we can hook into the flush callback chain, which the server will invoke just before flushing output. This lets us submit batch buffers before sending out events, preserving ordering.
Fixes 28438: [bisected] incorrect character in gnome-terminal under compiz
https://bugs.freedesktop.org/show_bug.cgi?id=28438Signed-off-by Kristian Høgsberg <[email protected]>
A flush callback makes more sense than a block handler. Is there a guide to the various hooks the xserver uses for io and the meaning of those barriers between clients? Do we have an idea of the impact this has in non-damage situations, does it impact aa10text? ;-) In intel_dri.c we manually flush the batchbuffer, should this be better expressed in terms of a call to a general flush func?
For what's it is worth, I approve of this change. :)
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 10 lines · Chris Wilson
Quoted 9 lines · Kristian Høgsberg
There are a few cases where the server will flush client output buffers but our block handler only catches the most common (before going into select). If the server flushes client buffers before we submit our batch buffer, the client may receive a damage event for rendering that hasn't happened yet.
Instead, we can hook into the flush callback chain, which the server will invoke just before flushing output. This lets us submit batch buffers before sending out events, preserving ordering.
Quoted 8 lines
Quoted 4 lines
Fixes 28438: [bisected] incorrect character in gnome-terminal under compiz
https://bugs.freedesktop.org/show_bug.cgi?id=28438Signed-off-by Kristian Høgsberg <[email protected]>A flush callback makes more sense than a block handler. Is there a guide to the various hooks the xserver uses for io and the meaning of those barriers between clients?
Not that I know, I discovered the callback when I was tracing the protocol flushing code. And as it is, it doesn't catch all flush cases - I sent a couple of patches to xorg-devel to cover those.
Quoted 2 lines
Do we have an idea of the impact this has in non-damage situations, does it impact aa10text? ;-)
It might, the flush that was causing the premature damage events wasmainly the FlushAllOutput() call in Dispatch(). It kicks in when the smart scheduler decides that a client has had the X server for too long. I guess the question is, do we normally fill up a batch buffer when we use up the entire time slot or will we be flushing too early...
Quoted 3 lines
In
intel_dri.cwe
manually flush the batchbuffer, should this be better expressed in terms of a call to a general flush func?
Yes, now that we submit in the flush callback, the manual flush shouldn't be necessary. The client will wait for the reply before it continues rendering, so we will hit the flush callback before the reply is written to the client.
Quoted 1 line
For what's it is worth, I approve of this change. :)
Thank you, that's important to me :)
Kristian
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx