Merge remote-tracking branch 'origin/master' into pipe-video
[mesa.git] / src / gallium / winsys / r600 / drm / r600_hw_context.c
index 0514bbeaba3b088d7af45c7afc5e37b00dd79ec1..34ea2a6bacb7708c5a88ef3d660b89fd30cf072a 100644 (file)
@@ -922,7 +922,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat
                }
                if (block->flags & REG_FLAG_DIRTY_ALWAYS)
                        dirty |= R600_BLOCK_STATUS_DIRTY;
                }
                if (block->flags & REG_FLAG_DIRTY_ALWAYS)
                        dirty |= R600_BLOCK_STATUS_DIRTY;
-               if (block->pm4_bo_index[id]) {
+               if (block->pm4_bo_index[id] && state->regs[i].bo) {
                        /* find relocation */
                        reloc_id = block->pm4_bo_index[id];
                        r600_bo_reference(ctx->radeon, &block->reloc[reloc_id].bo, state->regs[i].bo);
                        /* find relocation */
                        reloc_id = block->pm4_bo_index[id];
                        r600_bo_reference(ctx->radeon, &block->reloc[reloc_id].bo, state->regs[i].bo);
@@ -1145,13 +1145,15 @@ void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *
                if (block->pm4_bo_index[j]) {
                        /* find relocation */
                        id = block->pm4_bo_index[j];
                if (block->pm4_bo_index[j]) {
                        /* find relocation */
                        id = block->pm4_bo_index[j];
-                       r600_context_bo_reloc(ctx,
-                                       &block->pm4[block->reloc[id].bo_pm4_index],
-                                       block->reloc[id].bo);
-                       r600_context_bo_flush(ctx,
-                                       block->reloc[id].flush_flags,
-                                       block->reloc[id].flush_mask,
-                                       block->reloc[id].bo);
+                       if (block->reloc[id].bo) {
+                               r600_context_bo_reloc(ctx,
+                                               &block->pm4[block->reloc[id].bo_pm4_index],
+                                               block->reloc[id].bo);
+                               r600_context_bo_flush(ctx,
+                                               block->reloc[id].flush_flags,
+                                               block->reloc[id].flush_mask,
+                                               block->reloc[id].bo);
+                       }
                }
        }
        ctx->flags &= ~R600_CONTEXT_CHECK_EVENT_FLUSH;
                }
        }
        ctx->flags &= ~R600_CONTEXT_CHECK_EVENT_FLUSH;