diff options
-rw-r--r-- | src/gallium/drivers/radeon/r600_buffer_common.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 3 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_texture.c | 7 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c index 81409ced827..439a3cb30c0 100644 --- a/src/gallium/drivers/radeon/r600_buffer_common.c +++ b/src/gallium/drivers/radeon/r600_buffer_common.c @@ -455,6 +455,7 @@ r600_alloc_buffer_struct(struct pipe_screen *screen, rbuffer->b.vtbl = &r600_buffer_vtbl; rbuffer->buf = NULL; rbuffer->TC_L2_dirty = false; + rbuffer->is_shared = false; util_range_init(&rbuffer->valid_buffer_range); return rbuffer; } diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index b77b1321d73..4cef5ef1adc 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -166,6 +166,9 @@ struct r600_resource { * use TC L2. */ bool TC_L2_dirty; + + /* Whether the resource has been exported via resource_get_handle. */ + bool is_shared; }; struct r600_transfer { diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c index 377dd3de578..5e77080eed2 100644 --- a/src/gallium/drivers/radeon/r600_texture.c +++ b/src/gallium/drivers/radeon/r600_texture.c @@ -259,8 +259,11 @@ static boolean r600_texture_get_handle(struct pipe_screen* screen, struct r600_texture *rtex = (struct r600_texture*)resource; struct radeon_bo_metadata metadata; - r600_texture_init_metadata(rtex, &metadata); - rscreen->ws->buffer_set_metadata(res->buf, &metadata); + if (!res->is_shared) { + res->is_shared = true; + r600_texture_init_metadata(rtex, &metadata); + rscreen->ws->buffer_set_metadata(res->buf, &metadata); + } return rscreen->ws->buffer_get_handle(res->buf, rtex->surface.level[0].pitch_bytes, |