summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl/drm
diff options
context:
space:
mode:
authorThomas Hellstrom <[email protected]>2011-02-25 13:05:31 +0100
committerThomas Hellstrom <[email protected]>2011-03-01 10:36:19 +0100
commit8b145e23023927ddec7839a9e4498d5a42e3ca29 (patch)
tree98620a66dbbb2f9daec9064396bb69a2483b34de /src/gallium/state_trackers/egl/drm
parentc9febff31f1032065f96ad76fd31f31ac330fef9 (diff)
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 <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/egl/drm')
-rw-r--r--src/gallium/state_trackers/egl/drm/modeset.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gallium/state_trackers/egl/drm/modeset.c b/src/gallium/state_trackers/egl/drm/modeset.c
index 6eaa42fafb1..3fff9540905 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 <[email protected]>
+ * Thomas Hellstrom <[email protected]>
*/
#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);