summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <[email protected]>2014-09-11 09:38:50 +0200
committerChristian König <[email protected]>2014-09-11 15:06:03 +0200
commit4dfdcdb4b394df72da769806a0b64025e475f8b3 (patch)
tree36e16fdcd39b47d58c408011ea65c8d7d7e3e29d
parent4bc0059229f212e91ca266ef3f80b652b1cdcb86 (diff)
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 <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
-rw-r--r--src/gallium/drivers/radeon/radeon_uvd.c6
-rw-r--r--src/gallium/drivers/radeon/radeon_video.c10
-rw-r--r--src/gallium/drivers/radeon/radeon_video.h2
3 files changed, 8 insertions, 10 deletions
diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
index 6ad2d2476f3..69f5cdc6a57 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -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);
diff --git a/src/gallium/drivers/radeon/radeon_video.c b/src/gallium/drivers/radeon/radeon_video.c
index 0bc43907005..f6cfdff7aa2 100644
--- a/src/gallium/drivers/radeon/radeon_video.c
+++ b/src/gallium/drivers/radeon/radeon_video.c
@@ -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);
}
/**
diff --git a/src/gallium/drivers/radeon/radeon_video.h b/src/gallium/drivers/radeon/radeon_video.h
index fe3088a0b96..974ea4f47be 100644
--- a/src/gallium/drivers/radeon/radeon_video.h
+++ b/src/gallium/drivers/radeon/radeon_video.h
@@ -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 */