[PATCH Mesa] Enable throttling in SwapBuffers
Kristian Høgsberg
hoegsberg at gmail.com
Wed Dec 4 15:58:48 PST 2013
On Tue, Dec 03, 2013 at 05:04:10PM +0100, Axel Davy wrote:
> flush_with_flags, when available, allows the driver to throttle.
> Using this suppress input lag issues that can be observed in heavy
> rendering situations on non-intel cards.
>
> Signed-off-by: Axel Davy <axel.davy at ens.fr>
That makes sense, we need to use that. Patch applied and I added a CC
for the stable branch. Please follow the coding style used in the
file though, I made a few edits as described below.
Kristian
> ---
> We must fight input lag, since we can have situations where
> the sent buffer hasn't been touched yet at all by the driver.
> In this corner case, there is no lock on the buffer, and Weston
> would display the buffer which has not been rendered yet.
>
> src/egl/drivers/dri2/platform_wayland.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
> index f9065bb..7e3733b 100644
> --- a/src/egl/drivers/dri2/platform_wayland.c
> +++ b/src/egl/drivers/dri2/platform_wayland.c
> @@ -557,6 +557,8 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv,
> {
> struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
> struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
> + _EGLContext *ctx;
> + struct dri2_egl_context *dri2_ctx;
> int i, ret = 0;
>
> while (dri2_surf->frame_callback && ret != -1)
> @@ -612,7 +614,17 @@ dri2_swap_buffers_with_damage(_EGLDriver *drv,
>
> wl_surface_commit(dri2_surf->wl_win->surface);
>
> - (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
> + if (dri2_dpy->flush->base.version >= 4)
> + {
I put this { back on the same line as the if statement
> + ctx = _eglGetCurrentContext();
> + dri2_ctx = dri2_egl_context(ctx);
> + (*dri2_dpy->flush->flush_with_flags)(dri2_ctx->dri_context,
> + dri2_surf->dri_drawable,
> + __DRI2_FLUSH_DRAWABLE,
> + __DRI2_THROTTLE_SWAPBUFFER);
> + }
> + else
and this else on the same line as the } and added { } around the flush
call. If one branch of the if statement has braces, the other one
should too.
> + (*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
> (*dri2_dpy->flush->invalidate)(dri2_surf->dri_drawable);
>
> return EGL_TRUE;
> --
> 1.8.1.2
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list