[Mesa-dev] [PATCH 2/3] radeon/video: use the hw to initial clear the buffers
Christian König
deathsimple at vodafone.de
Thu Sep 11 00:55:08 PDT 2014
From: Christian König <christian.koenig at amd.com>
Less CPU overhead and avoids contention over CPU accessible memory on startup.
Signed-off-by: Christian König <christian.koenig at amd.com>
---
src/gallium/drivers/radeon/radeon_uvd.c | 6 +++---
src/gallium/drivers/radeon/radeon_video.c | 10 ++++------
src/gallium/drivers/radeon/radeon_video.h | 2 +-
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 6ad2d24..69f5cdc 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 0bc4390..f6cfdff 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 fe3088a..974ea4f 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 */
--
1.9.1
More information about the mesa-dev
mailing list