summaryrefslogtreecommitdiff
path: root/src/gallium/winsys/drm/radeon/core/radeon_r300.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/winsys/drm/radeon/core/radeon_r300.c')
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_r300.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
index 0875ee41cb..d759beaba1 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -81,9 +81,13 @@ static void radeon_write_cs_reloc(struct radeon_winsys* winsys,
uint32_t flags)
{
int retval = 0;
+ struct radeon_pipe_buffer* radeon_buffer =
+ (struct radeon_pipe_buffer*)pbuffer;
- retval = radeon_cs_write_reloc(winsys->priv->cs,
- ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags);
+ assert(!radeon_buffer->pb);
+
+ retval = radeon_cs_write_reloc(winsys->priv->cs, radeon_buffer->bo,
+ rd, wd, flags);
if (retval) {
debug_printf("radeon: Relocation of %p (%d, %d, %d) failed!\n",
@@ -108,6 +112,11 @@ static void radeon_flush_cs(struct radeon_winsys* winsys)
{
int retval;
+ /* Don't flush a zero-sized CS. */
+ if (!winsys->priv->cs->cdw) {
+ return;
+ }
+
/* Emit the CS. */
retval = radeon_cs_emit(winsys->priv->cs);
if (retval) {