[Mesa-dev] [PATCH 25/26] st/dri: random cleanups

Marek Olšák maraeo at gmail.com
Wed Feb 8 18:03:39 UTC 2017


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

---
 src/gallium/state_trackers/dri/dri_drawable.c | 11 +++++++----
 src/gallium/state_trackers/dri/dri_screen.c   |  8 +++++---
 2 files changed, 12 insertions(+), 7 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.
     */
diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c
index a950f52..9a8a0f9 100644
--- a/src/gallium/state_trackers/dri/dri_screen.c
+++ b/src/gallium/state_trackers/dri/dri_screen.c
@@ -75,23 +75,25 @@ const __DRIconfigOptionsExtension gallium_config_options = {
       DRI_CONF_SECTION_MISCELLANEOUS
          DRI_CONF_ALWAYS_HAVE_DEPTH_BUFFER("false")
          DRI_CONF_GLSL_ZERO_INIT("false")
       DRI_CONF_SECTION_END
    DRI_CONF_END
 };
 
 #define false 0
 
 static void
-dri_fill_st_options(struct st_config_options *options,
-                    const struct driOptionCache * optionCache)
+dri_fill_st_options(struct dri_screen *screen)
 {
+   struct st_config_options *options = &screen->options;
+   const struct driOptionCache *optionCache = &screen->optionCache;
+
    options->disable_blend_func_extended =
       driQueryOptionb(optionCache, "disable_blend_func_extended");
    options->disable_glsl_line_continuations =
       driQueryOptionb(optionCache, "disable_glsl_line_continuations");
    options->disable_shader_bit_encoding =
       driQueryOptionb(optionCache, "disable_shader_bit_encoding");
    options->force_glsl_extensions_warn =
       driQueryOptionb(optionCache, "force_glsl_extensions_warn");
    options->force_glsl_version =
       driQueryOptioni(optionCache, "force_glsl_version");
@@ -443,21 +445,21 @@ dri_init_screen_helper(struct dri_screen *screen,
    else
       screen->target = PIPE_TEXTURE_RECT;
 
    driParseOptionInfo(&screen->optionCacheDefaults, gallium_config_options.xml);
 
    driParseConfigFiles(&screen->optionCache,
                        &screen->optionCacheDefaults,
                        screen->sPriv->myNum,
                        driver_name);
 
-   dri_fill_st_options(&screen->options, &screen->optionCache);
+   dri_fill_st_options(screen);
 
    /* Handle force_s3tc_enable. */
    if (!util_format_s3tc_enabled && screen->options.force_s3tc_enable) {
       /* Ensure libtxc_dxtn has been loaded if available.
        * Forcing S3TC on before calling this would prevent loading
        * the library.
        * This is just a precaution, the driver should have called it
        * already.
        */
       util_format_s3tc_init();
-- 
2.7.4



More information about the mesa-dev mailing list