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>
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)) {
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);
}
/* 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);
}
/**
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 */