Mesa (master): st/egl: Use stamps only to avoid unnecessary geometry update .

Chia-I Wu olv at kemper.freedesktop.org
Mon May 31 12:08:37 UTC 2010


Module: Mesa
Branch: master
Commit: a27690931be9479353dd8ae0d52186f5c72f4380
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a27690931be9479353dd8ae0d52186f5c72f4380

Author: Chia-I Wu <olv at lunarg.com>
Date:   Mon May 31 19:59:57 2010 +0800

st/egl: Use stamps only to avoid unnecessary geometry update.

resource_surface_add_resources should still be called even when the
stamps match.  For example, a caller may ask for two different sets of
attachments.

---

 src/gallium/state_trackers/egl/gdi/native_gdi.c    |   18 ++++++++----------
 src/gallium/state_trackers/egl/x11/native_ximage.c |   18 ++++++++----------
 2 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/src/gallium/state_trackers/egl/gdi/native_gdi.c b/src/gallium/state_trackers/egl/gdi/native_gdi.c
index 64f1b1d..29e89bc 100644
--- a/src/gallium/state_trackers/egl/gdi/native_gdi.c
+++ b/src/gallium/state_trackers/egl/gdi/native_gdi.c
@@ -101,13 +101,13 @@ static boolean
 gdi_surface_update_buffers(struct native_surface *nsurf, uint buffer_mask)
 {
    struct gdi_surface *gsurf = gdi_surface(nsurf);
-   boolean ret;
 
-   gdi_surface_update_geometry(&gsurf->base);
-   ret = resource_surface_add_resources(gsurf->rsurf, buffer_mask);
-   gsurf->client_stamp = gsurf->server_stamp;
+   if (gsurf->client_stamp != gsurf->server_stamp) {
+      gdi_surface_update_geometry(&gsurf->base);
+      gsurf->client_stamp = gsurf->server_stamp;
+   }
 
-   return ret;
+   return resource_surface_add_resources(gsurf->rsurf, buffer_mask);
 }
 
 /**
@@ -170,10 +170,8 @@ gdi_surface_validate(struct native_surface *nsurf, uint attachment_mask,
    struct gdi_surface *gsurf = gdi_surface(nsurf);
    uint w, h;
 
-   if (gsurf->client_stamp != gsurf->server_stamp) {
-      if (!gdi_surface_update_buffers(&gsurf->base, attachment_mask))
-         return FALSE;
-   }
+   if (!gdi_surface_update_buffers(&gsurf->base, attachment_mask))
+      return FALSE;
 
    if (seq_num)
       *seq_num = gsurf->client_stamp;
@@ -233,7 +231,7 @@ gdi_display_create_window_surface(struct native_display *ndpy,
    }
 
    /* initialize the geometry */
-   gdi_surface_update_buffers(&gsurf->base, 0x0);
+   gdi_surface_update_geometry(&gsurf->base);
 
    gsurf->base.destroy = gdi_surface_destroy;
    gsurf->base.swap_buffers = gdi_surface_swap_buffers;
diff --git a/src/gallium/state_trackers/egl/x11/native_ximage.c b/src/gallium/state_trackers/egl/x11/native_ximage.c
index c60ec66..3388fc6 100644
--- a/src/gallium/state_trackers/egl/x11/native_ximage.c
+++ b/src/gallium/state_trackers/egl/x11/native_ximage.c
@@ -123,13 +123,13 @@ static boolean
 ximage_surface_update_buffers(struct native_surface *nsurf, uint buffer_mask)
 {
    struct ximage_surface *xsurf = ximage_surface(nsurf);
-   boolean ret;
 
-   ximage_surface_update_geometry(&xsurf->base);
-   ret = resource_surface_add_resources(xsurf->rsurf, buffer_mask);
-   xsurf->client_stamp = xsurf->server_stamp;
+   if (xsurf->client_stamp != xsurf->server_stamp) {
+      ximage_surface_update_geometry(&xsurf->base);
+      xsurf->client_stamp = xsurf->server_stamp;
+   }
 
-   return ret;
+   return resource_surface_add_resources(xsurf->rsurf, buffer_mask);
 }
 
 /**
@@ -185,10 +185,8 @@ ximage_surface_validate(struct native_surface *nsurf, uint attachment_mask,
    struct ximage_surface *xsurf = ximage_surface(nsurf);
    uint w, h;
 
-   if (xsurf->client_stamp != xsurf->server_stamp) {
-      if (!ximage_surface_update_buffers(&xsurf->base, attachment_mask))
-         return FALSE;
-   }
+   if (!ximage_surface_update_buffers(&xsurf->base, attachment_mask))
+      return FALSE;
 
    if (seq_num)
       *seq_num = xsurf->client_stamp;
@@ -255,7 +253,7 @@ ximage_display_create_surface(struct native_display *ndpy,
    xsurf->drawable = drawable;
    xsurf->visual = *xconf->visual;
    /* initialize the geometry */
-   ximage_surface_update_buffers(&xsurf->base, 0x0);
+   ximage_surface_update_geometry(&xsurf->base);
 
    xsurf->xdraw.visual = xsurf->visual.visual;
    xsurf->xdraw.depth = xsurf->visual.depth;




More information about the mesa-commit mailing list