gallium: plumb winsys-drawable-handle through to state tracker
[mesa.git] / src / gallium / state_trackers / dri / dri_context.c
index 6edbd9d9b157badd141ad2b13425c4fa597d1c48..2f991c39e33b82478eb7e9a6430ad803378ba168 100644 (file)
@@ -69,7 +69,7 @@ dri_create_context(const __GLcontextModes * visual,
    driParseConfigFiles(&ctx->optionCache,
                       &screen->optionCache, sPriv->myNum, "dri");
 
-   ctx->pipe = screen->pipe_screen->create_context( screen->pipe_screen,
+   ctx->pipe = screen->pipe_screen->context_create( screen->pipe_screen,
                                                    ctx );
 
    if (ctx->pipe == NULL)
@@ -128,7 +128,7 @@ dri_unbind_context(__DRIcontext * cPriv)
       if (--ctx->bind_count == 0) {
         if (ctx->st && ctx->st == st_get_current()) {
            st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
-           st_make_current(NULL, NULL, NULL);
+           st_make_current(NULL, NULL, NULL, NULL);
         }
       }
    }
@@ -161,18 +161,22 @@ dri_make_current(__DRIcontext * cPriv,
         ctx->r_stamp = driReadPriv->lastStamp - 1;
       }
 
-      st_make_current(ctx->st, draw->stfb, read->stfb);
+      /* DRI co-state tracker currently overrides flush_frontbuffer.
+       * When this is fixed, will need to pass the drawable in the
+       * fourth parameter here so that when Mesa calls
+       * flush_frontbuffer directly (in front-buffer rendering), it
+       * will have access to the drawable argument:
+       */
+      st_make_current(ctx->st, draw->stfb, read->stfb, NULL);
 
       if (__dri1_api_hooks) {
         dri1_update_drawables(ctx, draw, read);
       } else {
-        if (driDrawPriv)
-           dri_get_buffers(driDrawPriv);
-        if (driDrawPriv != driReadPriv && driReadPriv)
-           dri_get_buffers(driReadPriv);
+        dri_update_buffer(ctx->pipe->screen,
+                          ctx->pipe->priv);
       }
    } else {
-      st_make_current(NULL, NULL, NULL);
+      st_make_current(NULL, NULL, NULL, NULL);
    }
 
    return GL_TRUE;