[Mesa-dev] [PATCH 1/2] st/dri: use local pointer to st_context_iface

Timothy Arceri tarceri at itsqueeze.com
Mon Mar 6 04:03:16 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/state_trackers/dri/dri_drawable.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index edcd0e6..fd3b458 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -436,48 +436,51 @@ dri_postprocessing(struct dri_context *ctx,
  * \param throttle_reason   the reason for throttling, 0 = no throttling
  */
 void
 dri_flush(__DRIcontext *cPriv,
           __DRIdrawable *dPriv,
           unsigned flags,
           enum __DRI2throttleReason reason)
 {
    struct dri_context *ctx = dri_context(cPriv);
    struct dri_drawable *drawable = dri_drawable(dPriv);
+   struct st_context_iface *st;
    unsigned flush_flags;
    boolean swap_msaa_buffers = FALSE;
 
    if (!ctx) {
       assert(0);
       return;
    }
 
+   st = ctx->st;
+
    if (drawable) {
       /* prevent recursion */
       if (drawable->flushing)
          return;
 
       drawable->flushing = TRUE;
    }
    else {
       flags &= ~__DRI2_FLUSH_DRAWABLE;
    }
 
    /* Flush the drawable. */
    if ((flags & __DRI2_FLUSH_DRAWABLE) &&
        drawable->textures[ST_ATTACHMENT_BACK_LEFT]) {
-      struct pipe_context *pipe = ctx->st->pipe;
+      struct pipe_context *pipe = st->pipe;
 
       if (drawable->stvis.samples > 1 &&
           reason == __DRI2_THROTTLE_SWAPBUFFER) {
          /* Resolve the MSAA back buffer. */
-         dri_pipe_blit(ctx->st->pipe,
+         dri_pipe_blit(st->pipe,
                        drawable->textures[ST_ATTACHMENT_BACK_LEFT],
                        drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]);
 
          if (drawable->msaa_textures[ST_ATTACHMENT_FRONT_LEFT] &&
              drawable->msaa_textures[ST_ATTACHMENT_BACK_LEFT]) {
             swap_msaa_buffers = TRUE;
          }
 
          /* FRONT_LEFT is resolved in drawable->flush_frontbuffer. */
       }
@@ -522,29 +525,29 @@ dri_flush(__DRIcontext *cPriv,
        */
       struct pipe_screen *screen = drawable->screen->base.screen;
       struct pipe_fence_handle *fence;
 
       fence = swap_fences_pop_front(drawable);
       if (fence) {
          (void) screen->fence_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
          screen->fence_reference(screen, &fence, NULL);
       }
 
-      ctx->st->flush(ctx->st, flush_flags, &fence);
+      st->flush(st, flush_flags, &fence);
 
       if (fence) {
          swap_fences_push_back(drawable, fence);
          screen->fence_reference(screen, &fence, NULL);
       }
    }
    else if (flags & (__DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT)) {
-      ctx->st->flush(ctx->st, flush_flags, NULL);
+      st->flush(st, flush_flags, NULL);
    }
 
    if (drawable) {
       drawable->flushing = FALSE;
    }
 
    /* Swap the MSAA front and back buffers, so that reading
     * from the front buffer after SwapBuffers returns what was
     * in the back buffer.
     */
-- 
2.9.3



More information about the mesa-dev mailing list