r600: allocate immed buffer resource for images.
In order to image readback we have to execute a MEM_RAT instruction that needs a buffer to transfer the result into until the shader can fetch it. Tested-By: Gert Wollny <gw.fossdev@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -251,6 +251,7 @@ static void r600_buffer_destroy(struct pipe_screen *screen,
|
||||
|
||||
threaded_resource_deinit(buf);
|
||||
util_range_destroy(&rbuffer->valid_buffer_range);
|
||||
pipe_resource_reference((struct pipe_resource**)&rbuffer->immed_buffer, NULL);
|
||||
pb_reference(&rbuffer->buf, NULL);
|
||||
FREE(rbuffer);
|
||||
}
|
||||
@@ -606,6 +607,7 @@ r600_alloc_buffer_struct(struct pipe_screen *screen,
|
||||
|
||||
rbuffer->buf = NULL;
|
||||
rbuffer->bind_history = 0;
|
||||
rbuffer->immed_buffer = NULL;
|
||||
util_range_init(&rbuffer->valid_buffer_range);
|
||||
return rbuffer;
|
||||
}
|
||||
|
||||
@@ -171,6 +171,12 @@ struct r600_resource {
|
||||
/* Whether this resource is referenced by bindless handles. */
|
||||
bool texture_handle_allocated;
|
||||
bool image_handle_allocated;
|
||||
|
||||
/*
|
||||
* EG/Cayman only - for RAT operations hw need an immediate buffer
|
||||
* to store results in.
|
||||
*/
|
||||
struct r600_resource *immed_buffer;
|
||||
};
|
||||
|
||||
struct r600_transfer {
|
||||
@@ -773,6 +779,9 @@ void evergreen_do_fast_color_clear(struct r600_common_context *rctx,
|
||||
const union pipe_color_union *color);
|
||||
void r600_init_screen_texture_functions(struct r600_common_screen *rscreen);
|
||||
void r600_init_context_texture_functions(struct r600_common_context *rctx);
|
||||
void eg_resource_alloc_immed(struct r600_common_screen *rscreen,
|
||||
struct r600_resource *res,
|
||||
unsigned immed_size);
|
||||
|
||||
/* r600_viewport.c */
|
||||
void evergreen_apply_scissor_bug_workaround(struct r600_common_context *rctx,
|
||||
|
||||
@@ -559,6 +559,7 @@ static void r600_texture_destroy(struct pipe_screen *screen,
|
||||
struct r600_resource *resource = &rtex->resource;
|
||||
|
||||
r600_texture_reference(&rtex->flushed_depth_texture, NULL);
|
||||
pipe_resource_reference((struct pipe_resource**)&resource->immed_buffer, NULL);
|
||||
|
||||
if (rtex->cmask_buffer != &rtex->resource) {
|
||||
r600_resource_reference(&rtex->cmask_buffer, NULL);
|
||||
@@ -718,6 +719,15 @@ static void r600_texture_alloc_cmask_separate(struct r600_common_screen *rscreen
|
||||
p_atomic_inc(&rscreen->compressed_colortex_counter);
|
||||
}
|
||||
|
||||
void eg_resource_alloc_immed(struct r600_common_screen *rscreen,
|
||||
struct r600_resource *res,
|
||||
unsigned immed_size)
|
||||
{
|
||||
res->immed_buffer = (struct r600_resource *)
|
||||
pipe_buffer_create(&rscreen->b, PIPE_BIND_CUSTOM,
|
||||
PIPE_USAGE_DEFAULT, immed_size);
|
||||
}
|
||||
|
||||
static void r600_texture_get_htile_size(struct r600_common_screen *rscreen,
|
||||
struct r600_texture *rtex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user