summaryrefslogtreecommitdiff
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorMarek Olšák <marek.olsak@amd.com>2016-06-21 21:17:44 +0200
committerMarek Olšák <marek.olsak@amd.com>2016-06-29 20:12:00 +0200
commit36cf5a57c2b53b50778482f7341b7afcdc434daf (patch)
treef0265c0dfdccffbc84cec3eaa8fee860394dfa1b /src/gallium/drivers
parent6da92df538824d72e68ed4e290da57f51b00064a (diff)
gallium/radeon: add and use r600_texture_reference
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Vedran Miletić <vedran@miletic.net> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/r600_uvd.c2
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.c3
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h6
-rw-r--r--src/gallium/drivers/radeon/r600_texture.c10
-rw-r--r--src/gallium/drivers/radeonsi/si_uvd.c2
5 files changed, 13 insertions, 10 deletions
diff --git a/src/gallium/drivers/r600/r600_uvd.c b/src/gallium/drivers/r600/r600_uvd.c
index 628ba2a4fe..f1b1ca8113 100644
--- a/src/gallium/drivers/r600/r600_uvd.c
+++ b/src/gallium/drivers/r600/r600_uvd.c
@@ -131,7 +131,7 @@ struct pipe_video_buffer *r600_video_buffer_create(struct pipe_context *pipe,
error:
for (i = 0; i < VL_NUM_COMPONENTS; ++i)
- pipe_resource_reference((struct pipe_resource **)&resources[i], NULL);
+ r600_texture_reference(&resources[i], NULL);
return NULL;
}
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index 1a892ab91e..6b701b6cdd 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -483,8 +483,7 @@ void r600_common_context_cleanup(struct r600_common_context *rctx)
rctx->b.destroy_query(&rctx->b,
rctx->dcc_stats[i].ps_stats[j]);
- pipe_resource_reference((struct pipe_resource**)
- &rctx->dcc_stats[i].tex, NULL);
+ r600_texture_reference(&rctx->dcc_stats[i].tex, NULL);
}
if (rctx->gfx.cs)
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index 5fee658216..203d863f26 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -794,6 +794,12 @@ r600_resource_reference(struct r600_resource **ptr, struct r600_resource *res)
(struct pipe_resource *)res);
}
+static inline void
+r600_texture_reference(struct r600_texture **ptr, struct r600_texture *res)
+{
+ pipe_resource_reference((struct pipe_resource **)ptr, &res->resource.b.b);
+}
+
static inline bool r600_get_strmout_en(struct r600_common_context *rctx)
{
return rctx->streamout.streamout_enabled ||
diff --git a/src/gallium/drivers/radeon/r600_texture.c b/src/gallium/drivers/radeon/r600_texture.c
index 13ade4417b..d7ff2f77c3 100644
--- a/src/gallium/drivers/radeon/r600_texture.c
+++ b/src/gallium/drivers/radeon/r600_texture.c
@@ -479,7 +479,7 @@ static void r600_degrade_tile_mode_to_linear(struct r600_common_context *rctx,
assert(!rtex->dcc_offset);
assert(!rtex->is_depth);
- pipe_resource_reference((struct pipe_resource**)&new_tex, NULL);
+ r600_texture_reference(&new_tex, NULL);
r600_dirty_all_framebuffer_states(rctx->screen);
p_atomic_inc(&rctx->screen->dirty_tex_descriptor_counter);
@@ -561,7 +561,7 @@ static void r600_texture_destroy(struct pipe_screen *screen,
struct r600_resource *resource = &rtex->resource;
if (rtex->flushed_depth_texture)
- pipe_resource_reference((struct pipe_resource **)&rtex->flushed_depth_texture, NULL);
+ r600_texture_reference(&rtex->flushed_depth_texture, NULL);
r600_resource_reference(&rtex->htile_buffer, NULL);
if (rtex->cmask_buffer != &rtex->resource) {
@@ -1759,14 +1759,12 @@ static unsigned vi_get_context_dcc_stats_index(struct r600_common_context *rctx,
rctx->dcc_stats[oldest_slot].ps_stats[i] = NULL;
}
- pipe_resource_reference((struct pipe_resource**)
- &rctx->dcc_stats[oldest_slot].tex, NULL);
+ r600_texture_reference(&rctx->dcc_stats[oldest_slot].tex, NULL);
empty_slot = oldest_slot;
}
/* Add the texture to the new slot. */
- pipe_resource_reference((struct pipe_resource**)&rctx->dcc_stats[empty_slot].tex,
- &tex->resource.b.b);
+ r600_texture_reference(&rctx->dcc_stats[empty_slot].tex, tex);
rctx->dcc_stats[empty_slot].last_use_timestamp = os_time_get();
return empty_slot;
}
diff --git a/src/gallium/drivers/radeonsi/si_uvd.c b/src/gallium/drivers/radeonsi/si_uvd.c
index 8c3e5fd865..0d5bc378b2 100644
--- a/src/gallium/drivers/radeonsi/si_uvd.c
+++ b/src/gallium/drivers/radeonsi/si_uvd.c
@@ -113,7 +113,7 @@ struct pipe_video_buffer *si_video_buffer_create(struct pipe_context *pipe,
error:
for (i = 0; i < VL_NUM_COMPONENTS; ++i)
- pipe_resource_reference((struct pipe_resource **)&resources[i], NULL);
+ r600_texture_reference(&resources[i], NULL);
return NULL;
}