Module: Mesa
Branch: master
Commit: 8b5485957e19287f7e694e7e87eed784c44bb1e2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b5485957e19287f7e694e7e87eed784c44bb1e2

Author: Marek Olšák <[email protected]>
Date:   Sun Feb 26 18:48:28 2017 +0100

gallium/radeon: unwrap a context if we get a wrapped one

Reviewed-by: Nicolai Hähnle <[email protected]>
Tested-by: Dieter Nützel <[email protected]>

---

 src/gallium/drivers/radeon/r600_pipe_common.c | 6 ++++--
 src/gallium/drivers/radeon/r600_texture.c     | 6 ++++--
 src/gallium/drivers/radeonsi/si_pipe.c        | 2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
b/src/gallium/drivers/radeon/r600_pipe_common.c
index f958807a1c..48f0bf9a8e 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -1220,10 +1220,12 @@ static boolean r600_fence_finish(struct pipe_screen 
*screen,
 {
        struct radeon_winsys *rws = ((struct r600_common_screen*)screen)->ws;
        struct r600_multi_fence *rfence = (struct r600_multi_fence *)fence;
-       struct r600_common_context *rctx =
-               ctx ? (struct r600_common_context*)ctx : NULL;
+       struct r600_common_context *rctx;
        int64_t abs_timeout = os_time_get_absolute_timeout(timeout);
 
+       ctx = threaded_context_unwrap_sync(ctx);
+       rctx = ctx ? (struct r600_common_context*)ctx : NULL;
+
        if (rfence->sdma) {
                if (!rws->fence_wait(rws, rfence->sdma, timeout))
                        return false;
diff --git a/src/gallium/drivers/radeon/r600_texture.c 
b/src/gallium/drivers/radeon/r600_texture.c
index 57e3960268..449d7bc6cf 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -530,14 +530,16 @@ static boolean r600_texture_get_handle(struct 
pipe_screen* screen,
                                        unsigned usage)
 {
        struct r600_common_screen *rscreen = (struct r600_common_screen*)screen;
-       struct r600_common_context *rctx = (struct r600_common_context*)
-                                          (ctx ? ctx : rscreen->aux_context);
+       struct r600_common_context *rctx;
        struct r600_resource *res = (struct r600_resource*)resource;
        struct r600_texture *rtex = (struct r600_texture*)resource;
        struct radeon_bo_metadata metadata;
        bool update_metadata = false;
        unsigned stride, offset, slice_size;
 
+       ctx = threaded_context_unwrap_sync(ctx);
+       rctx = (struct r600_common_context*)(ctx ? ctx : rscreen->aux_context);
+
        /* This is not supported now, but it might be required for OpenCL
         * interop in the future.
         */
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index 0c85fdee3c..5edfed3f0d 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -155,7 +155,7 @@ static struct pipe_context *si_create_context(struct 
pipe_screen *screen,
                sscreen->record_llvm_ir = true; /* racy but not critical */
 
        sctx->b.b.screen = screen; /* this must be set first */
-       sctx->b.b.priv = priv;
+       sctx->b.b.priv = NULL;
        sctx->b.b.destroy = si_destroy_context;
        sctx->b.b.emit_string_marker = si_emit_string_marker;
        sctx->b.set_atom_dirty = (void *)si_set_atom_dirty;

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to