From 8b145e23023927ddec7839a9e4498d5a42e3ca29 Mon Sep 17 00:00:00 2001 From: Thomas Hellstrom Date: Fri, 25 Feb 2011 13:05:31 +0100 Subject: st/egl: Implement swapbuffer throttling When doing copy swapbuffers using drm, throttle on outstanding copy operations. Introduces a new environment variable, EGL_THROTTLE_FENCES that the user can use to indicate the desired number of outstanding swapbuffers, or disable throttling using EGL_THROTTLE_FENCES=0. This can and perhaps should be extended to the pageflip case as well, since with some hardware pageflips can be pipelined. In case the pageflip syncs, the throttle operation will be a no-op anyway. Update copyright notices. Signed-off-by: Thomas Hellstrom --- src/gallium/state_trackers/egl/drm/modeset.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/gallium/state_trackers/egl/drm') diff --git a/src/gallium/state_trackers/egl/drm/modeset.c b/src/gallium/state_trackers/egl/drm/modeset.c index 6eaa42fafb..3fff954090 100644 --- a/src/gallium/state_trackers/egl/drm/modeset.c +++ b/src/gallium/state_trackers/egl/drm/modeset.c @@ -3,6 +3,7 @@ * Version: 7.9 * * Copyright (C) 2010 LunarG Inc. + * Copyright (C) 2011 VMware Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -24,6 +25,7 @@ * * Authors: * Chia-I Wu + * Thomas Hellstrom */ #include "util/u_memory.h" @@ -136,8 +138,12 @@ drm_surface_copy_swap(struct native_surface *nsurf) struct drm_surface *drmsurf = drm_surface(nsurf); struct drm_display *drmdpy = drmsurf->drmdpy; - if (!resource_surface_copy_swap(drmsurf->rsurf, &drmdpy->base) || - !drm_surface_flush_frontbuffer(nsurf)) + (void) resource_surface_throttle(drmsurf->rsurf); + if (!resource_surface_copy_swap(drmsurf->rsurf, &drmdpy->base)) + return FALSE; + + (void) resource_surface_flush(drmsurf->rsurf, &drmdpy->base); + if (!drm_surface_flush_frontbuffer(nsurf)) return FALSE; drmsurf->sequence_number++; @@ -218,7 +224,9 @@ drm_surface_present(struct native_surface *nsurf, static void drm_surface_wait(struct native_surface *nsurf) { - /* no-op */ + struct drm_surface *drmsurf = drm_surface(nsurf); + + resource_surface_wait(drmsurf->rsurf); } static void @@ -226,6 +234,7 @@ drm_surface_destroy(struct native_surface *nsurf) { struct drm_surface *drmsurf = drm_surface(nsurf); + resource_surface_wait(drmsurf->rsurf); if (drmsurf->current_crtc.crtc) drmModeFreeCrtc(drmsurf->current_crtc.crtc); -- cgit v1.2.3