radeon/video: use the hw to initial clear the buffers
Less CPU overhead and avoids contention over CPU accessible memory on startup. Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
This commit is contained in:
@@ -830,8 +830,8 @@ struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
|
||||
goto error;
|
||||
}
|
||||
|
||||
rvid_clear_buffer(dec->ws, dec->cs, &dec->msg_fb_buffers[i]);
|
||||
rvid_clear_buffer(dec->ws, dec->cs, &dec->bs_buffers[i]);
|
||||
rvid_clear_buffer(context, &dec->msg_fb_buffers[i]);
|
||||
rvid_clear_buffer(context, &dec->bs_buffers[i]);
|
||||
}
|
||||
|
||||
if (!rvid_create_buffer(dec->screen, &dec->dpb, dpb_size, PIPE_USAGE_DEFAULT)) {
|
||||
@@ -839,7 +839,7 @@ struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
|
||||
goto error;
|
||||
}
|
||||
|
||||
rvid_clear_buffer(dec->ws, dec->cs, &dec->dpb);
|
||||
rvid_clear_buffer(context, &dec->dpb);
|
||||
|
||||
map_msg_fb_buf(dec);
|
||||
dec->msg->size = sizeof(*dec->msg);
|
||||
|
||||
@@ -118,14 +118,12 @@ error:
|
||||
}
|
||||
|
||||
/* clear the buffer with zeros */
|
||||
void rvid_clear_buffer(struct radeon_winsys *ws, struct radeon_winsys_cs *cs, struct rvid_buffer* buffer)
|
||||
void rvid_clear_buffer(struct pipe_context *context, struct rvid_buffer* buffer)
|
||||
{
|
||||
void *ptr = ws->buffer_map(buffer->res->cs_buf, cs, PIPE_TRANSFER_WRITE);
|
||||
if (!ptr)
|
||||
return;
|
||||
struct r600_common_context *rctx = (struct r600_common_context*)context;
|
||||
|
||||
memset(ptr, 0, buffer->res->buf->size);
|
||||
ws->buffer_unmap(buffer->res->cs_buf);
|
||||
rctx->clear_buffer(context, &buffer->res->b.b, 0, buffer->res->buf->size, 0);
|
||||
context->flush(context, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -62,7 +62,7 @@ bool rvid_resize_buffer(struct pipe_screen *screen, struct radeon_winsys_cs *cs,
|
||||
struct rvid_buffer *new_buf, unsigned new_size);
|
||||
|
||||
/* clear the buffer with zeros */
|
||||
void rvid_clear_buffer(struct radeon_winsys *ws, struct radeon_winsys_cs *cs, struct rvid_buffer* buffer);
|
||||
void rvid_clear_buffer(struct pipe_context *context, struct rvid_buffer* buffer);
|
||||
|
||||
/* join surfaces into the same buffer with identical tiling params
|
||||
sumup their sizes and replace the backend buffers with a single bo */
|
||||
|
||||
Reference in New Issue
Block a user