summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2016-02-24 17:32:53 +0100
committerMarek Olšák <[email protected]>2016-03-09 15:02:26 +0100
commitf914779c75b01f344ff8d63f572abc71179f44d7 (patch)
tree72c34b60d92f5cdfe1b942f6ebd59b86b55c31af /src
parent69d8b7511420e3c9053dc57da9d7f478c2baca48 (diff)
gallium/radeon: set texture metadata only once
Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeon/r600_buffer_common.c1
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h3
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c7
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,