[Mesa-dev] [PATCH 02/12] st/dri: remove dead code and incorrect comment around make_current

Marek Olšák maraeo at gmail.com
Tue Nov 21 17:46:02 UTC 2017


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

Core Mesa already handles flushing based on ContextReleaseBehavior,
so the comment is wrong.

Also, old_st is always NULL, because unbind_context always precedes
make_current.
---
 src/gallium/state_trackers/dri/dri_context.c | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_context.c b/src/gallium/state_trackers/dri/dri_context.c
index f5400ab..d123f9c 100644
--- a/src/gallium/state_trackers/dri/dri_context.c
+++ b/src/gallium/state_trackers/dri/dri_context.c
@@ -229,49 +229,36 @@ dri_unbind_context(__DRIcontext * cPriv)
    struct dri_screen *screen = dri_screen(cPriv->driScreenPriv);
    struct dri_context *ctx = dri_context(cPriv);
    struct st_context_iface *st = ctx->st;
    struct st_api *stapi = screen->st_api;
 
    if (--ctx->bind_count == 0) {
       if (st == stapi->get_current(stapi)) {
          if (st->thread_finish)
             st->thread_finish(st);
 
-         /* For conformance, unbind is supposed to flush the context.
-          * However, if we do it here we might end up flushing a partially
-          * destroyed context. Instead, we flush in dri_make_current and
-          * in dri_destroy_context which should cover all the cases.
-          */
          stapi->make_current(stapi, NULL, NULL, NULL);
       }
    }
 
    return GL_TRUE;
 }
 
 GLboolean
 dri_make_current(__DRIcontext * cPriv,
 		 __DRIdrawable * driDrawPriv,
 		 __DRIdrawable * driReadPriv)
 {
    /* dri_util.c ensures cPriv is not null */
    struct dri_context *ctx = dri_context(cPriv);
    struct dri_drawable *draw = dri_drawable(driDrawPriv);
    struct dri_drawable *read = dri_drawable(driReadPriv);
-   struct st_context_iface *old_st = ctx->stapi->get_current(ctx->stapi);
-
-   if (old_st && old_st->thread_finish)
-      old_st->thread_finish(old_st);
-
-   /* Flush the old context here so we don't have to flush on unbind() */
-   if (old_st && old_st != ctx->st)
-      old_st->flush(old_st, ST_FLUSH_FRONT, NULL);
 
    ++ctx->bind_count;
 
    if (!draw && !read)
       return ctx->stapi->make_current(ctx->stapi, ctx->st, NULL, NULL);
    else if (!draw || !read)
       return GL_FALSE;
 
    if (ctx->dPriv != driDrawPriv) {
       ctx->dPriv = driDrawPriv;
-- 
2.7.4



More information about the mesa-dev mailing list