Mesa (mesa_7_7_branch): wgl: Call st_swapbuffers instead of st_notify_swapbuffers.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Dec 2 09:05:38 PST 2009


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Dec  2 17:05:20 2009 +0000

wgl: Call st_swapbuffers instead of st_notify_swapbuffers.

This will get single buffer, double buffer, and
joint single/double buffer (typical in CAD applications) done right,
at least as far as the frambuffer is concerned.

There are still problems with multiple contexts using the same
framebuffer because st_framebuffer_* calls assume the framebuffer
is bound to a single context.

---

 src/gallium/state_trackers/wgl/stw_device.c      |   14 +---------
 src/gallium/state_trackers/wgl/stw_framebuffer.c |   31 +++++-----------------
 src/gallium/state_trackers/wgl/stw_framebuffer.h |    3 +-
 3 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c
index 985b8f0..7785aba 100644
--- a/src/gallium/state_trackers/wgl/stw_device.c
+++ b/src/gallium/state_trackers/wgl/stw_device.c
@@ -72,19 +72,7 @@ stw_flush_frontbuffer(struct pipe_screen *screen,
       return;
    }
 
-#if DEBUG
-   {
-      /* ensure that a random surface was not passed to us */
-      struct pipe_surface *surface2;
-
-      if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 ))
-         assert(0);
-      else
-         assert(surface2 == surface);
-   }
-#endif
-
-   stw_framebuffer_present_locked(hdc, fb, ST_SURFACE_FRONT_LEFT);
+   stw_framebuffer_present_locked(hdc, fb, surface);
 }
 
 
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c
index 8a3e11b..6d09501 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.c
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c
@@ -475,8 +475,6 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
    struct stw_framebuffer *fb;
    struct pipe_screen *screen;
    struct pipe_surface *surface;
-   unsigned surface_index;
-   BOOL ret = FALSE;
 
    fb = stw_framebuffer_from_hdc( hdc );
    if (fb == NULL)
@@ -484,9 +482,7 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
 
    screen = stw_dev->screen;
 
-   surface_index = (unsigned)(uintptr_t)data->pPrivateData;
-   if(!st_get_framebuffer_surface( fb->stfb, surface_index, &surface ))
-      goto fail;
+   surface = (struct pipe_surface *)data->pPrivateData;
 
 #ifdef DEBUG
    if(stw_dev->trace_running) {
@@ -520,15 +516,11 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data)
       stw_dev->stw_winsys->present( screen, surface, hdc );
    }
 
-   ret = TRUE;
-
-fail:
-
    stw_framebuffer_update(fb);
 
    stw_framebuffer_release(fb);
 
-   return ret;
+   return TRUE;
 }
 
 
@@ -540,7 +532,7 @@ fail:
 BOOL
 stw_framebuffer_present_locked(HDC hdc,
                                struct stw_framebuffer *fb,
-                               unsigned surface_index)
+                               struct pipe_surface *surface)
 {
    if(stw_dev->callbacks.wglCbPresentBuffers &&
       stw_dev->stw_winsys->compose) {
@@ -551,7 +543,7 @@ stw_framebuffer_present_locked(HDC hdc,
       data.magic2 = 0;
       data.AdapterLuid = stw_dev->AdapterLuid;
       data.rect = fb->client_rect;
-      data.pPrivateData = (void *)(uintptr_t)surface_index;
+      data.pPrivateData = (void *)surface;
 
       stw_framebuffer_release(fb);
 
@@ -559,13 +551,6 @@ stw_framebuffer_present_locked(HDC hdc,
    }
    else {
       struct pipe_screen *screen = stw_dev->screen;
-      struct pipe_surface *surface;
-
-      if(!st_get_framebuffer_surface( fb->stfb, surface_index, &surface )) {
-         /* FIXME: this shouldn't happen, but does on glean */
-         stw_framebuffer_release(fb);
-         return FALSE;
-      }
 
 #ifdef DEBUG
       if(stw_dev->trace_running) {
@@ -590,6 +575,7 @@ DrvSwapBuffers(
    HDC hdc )
 {
    struct stw_framebuffer *fb;
+   struct pipe_surface *surface = NULL;
 
    fb = stw_framebuffer_from_hdc( hdc );
    if (fb == NULL)
@@ -600,12 +586,9 @@ DrvSwapBuffers(
       return TRUE;
    }
 
-   /* If we're swapping the buffer associated with the current context
-    * we have to flush any pending rendering commands first.
-    */
-   st_notify_swapbuffers( fb->stfb );
+   st_swapbuffers(fb->stfb, &surface, NULL);
 
-   return stw_framebuffer_present_locked(hdc, fb, ST_SURFACE_BACK_LEFT);
+   return stw_framebuffer_present_locked(hdc, fb, surface);
 }
 
 
diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.h b/src/gallium/state_trackers/wgl/stw_framebuffer.h
index 5afbe74..b80d168 100644
--- a/src/gallium/state_trackers/wgl/stw_framebuffer.h
+++ b/src/gallium/state_trackers/wgl/stw_framebuffer.h
@@ -34,6 +34,7 @@
 
 #include "pipe/p_thread.h"
 
+struct pipe_surface;
 struct stw_pixelformat_info;
 
 /**
@@ -140,7 +141,7 @@ stw_framebuffer_allocate(
 BOOL
 stw_framebuffer_present_locked(HDC hdc,
                                struct stw_framebuffer *fb,
-                               unsigned surface_index);
+                               struct pipe_surface *surface);
 
 void
 stw_framebuffer_update(



More information about the mesa-commit mailing list