gallium/radeon: remember that texture_from_handle was called and its flags
authorMarek Olšák <marek.olsak@amd.com>
Wed, 24 Feb 2016 23:23:21 +0000 (00:23 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 9 Mar 2016 14:02:26 +0000 (15:02 +0100)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_texture.c

index 5f49dd7df5d80284287351bd1e81a422c67a63f4..8fc236e713cbb2f494f6a4428f193314efad506c 100644 (file)
@@ -908,6 +908,7 @@ static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen
        struct radeon_surf surface;
        int r;
        struct radeon_bo_metadata metadata = {};
+       struct r600_texture *rtex;
 
        /* Support only 2D textures without mipmaps */
        if ((templ->target != PIPE_TEXTURE_2D && templ->target != PIPE_TEXTURE_RECT) ||
@@ -941,8 +942,14 @@ static struct pipe_resource *r600_texture_from_handle(struct pipe_screen *screen
        if (metadata.scanout)
                surface.flags |= RADEON_SURF_SCANOUT;
 
-       return (struct pipe_resource *)r600_texture_create_object(screen, templ,
-                                                                 stride, buf, &surface);
+       rtex = r600_texture_create_object(screen, templ,
+                                         stride, buf, &surface);
+       if (!rtex)
+               return NULL;
+
+       rtex->resource.is_shared = true;
+       rtex->resource.external_usage = usage;
+       return &rtex->resource.b.b;
 }
 
 bool r600_init_flushed_depth_texture(struct pipe_context *ctx,