r300g,uvd,vce: set priorities for relocations
authorMarek Olšák <marek.olsak@amd.com>
Thu, 20 Feb 2014 14:35:15 +0000 (15:35 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 11 Mar 2014 17:51:19 +0000 (18:51 +0100)
This updates all occurences of cs_add_reloc.

src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/radeon/r600_cs.h
src/gallium/drivers/radeon/radeon_uvd.c
src/gallium/drivers/radeon/radeon_vce.h
src/gallium/winsys/radeon/drm/radeon_drm_cs.c
src/gallium/winsys/radeon/drm/radeon_winsys.h

index b038a9719aebdede7476c2a15f6b8ef506e4f4ed..d99b91919c4a3154824c4ddc7f1ef2c4f69222cf 100644 (file)
@@ -1314,7 +1314,10 @@ validate:
             assert(tex && tex->buf && "cbuf is marked, but NULL!");
             r300->rws->cs_add_reloc(r300->cs, tex->cs_buf,
                                     RADEON_USAGE_READWRITE,
-                                    r300_surface(fb->cbufs[i])->domain);
+                                    r300_surface(fb->cbufs[i])->domain,
+                                    tex->b.b.nr_samples > 1 ?
+                                    RADEON_PRIO_COLOR_BUFFER_MSAA :
+                                    RADEON_PRIO_COLOR_BUFFER);
         }
         /* ...depth buffer... */
         if (fb->zsbuf) {
@@ -1322,7 +1325,10 @@ validate:
             assert(tex && tex->buf && "zsbuf is marked, but NULL!");
             r300->rws->cs_add_reloc(r300->cs, tex->cs_buf,
                                     RADEON_USAGE_READWRITE,
-                                    r300_surface(fb->zsbuf)->domain);
+                                    r300_surface(fb->zsbuf)->domain,
+                                    tex->b.b.nr_samples > 1 ?
+                                    RADEON_PRIO_DEPTH_BUFFER_MSAA :
+                                    RADEON_PRIO_DEPTH_BUFFER);
         }
     }
     /* The AA resolve buffer. */
@@ -1330,7 +1336,8 @@ validate:
         if (aa->dest) {
             r300->rws->cs_add_reloc(r300->cs, aa->dest->cs_buf,
                                     RADEON_USAGE_WRITE,
-                                    aa->dest->domain);
+                                    aa->dest->domain,
+                                    RADEON_PRIO_COLOR_BUFFER);
         }
     }
     if (r300->textures_state.dirty) {
@@ -1342,17 +1349,19 @@ validate:
 
             tex = r300_resource(texstate->sampler_views[i]->base.texture);
             r300->rws->cs_add_reloc(r300->cs, tex->cs_buf, RADEON_USAGE_READ,
-                                    tex->domain);
+                                    tex->domain, RADEON_PRIO_SHADER_TEXTURE_RO);
         }
     }
     /* ...occlusion query buffer... */
     if (r300->query_current)
         r300->rws->cs_add_reloc(r300->cs, r300->query_current->cs_buf,
-                                RADEON_USAGE_WRITE, RADEON_DOMAIN_GTT);
+                                RADEON_USAGE_WRITE, RADEON_DOMAIN_GTT,
+                                RADEON_PRIO_MIN);
     /* ...vertex buffer for SWTCL path... */
     if (r300->vbo_cs)
         r300->rws->cs_add_reloc(r300->cs, r300->vbo_cs,
-                                RADEON_USAGE_READ, RADEON_DOMAIN_GTT);
+                                RADEON_USAGE_READ, RADEON_DOMAIN_GTT,
+                                RADEON_PRIO_MIN);
     /* ...vertex buffers for HWTCL path... */
     if (do_validate_vertex_buffers && r300->vertex_arrays_dirty) {
         struct pipe_vertex_buffer *vbuf = r300->vertex_buffer;
@@ -1367,14 +1376,16 @@ validate:
 
             r300->rws->cs_add_reloc(r300->cs, r300_resource(buf)->cs_buf,
                                     RADEON_USAGE_READ,
-                                    r300_resource(buf)->domain);
+                                    r300_resource(buf)->domain,
+                                    RADEON_PRIO_SHADER_BUFFER_RO);
         }
     }
     /* ...and index buffer for HWTCL path. */
     if (index_buffer)
         r300->rws->cs_add_reloc(r300->cs, r300_resource(index_buffer)->cs_buf,
                                 RADEON_USAGE_READ,
-                                r300_resource(index_buffer)->domain);
+                                r300_resource(index_buffer)->domain,
+                                RADEON_PRIO_MIN);
 
     /* Now do the validation (flush is called inside cs_validate on failure). */
     if (!r300->rws->cs_validate(r300->cs)) {
index c3af3decfcc8dc391ebdfac7b33078d46b7dcc40..45dc76c433b4c4130968d0d9a2cd0e59dd9316fc 100644 (file)
@@ -63,7 +63,8 @@ static INLINE unsigned r600_context_bo_reloc(struct r600_common_context *rctx,
                        rctx->rings.gfx.flush(rctx, RADEON_FLUSH_ASYNC);
                }
        }
-       return rctx->ws->cs_add_reloc(ring->cs, rbo->cs_buf, usage, rbo->domains) * 4;
+       return rctx->ws->cs_add_reloc(ring->cs, rbo->cs_buf, usage,
+                                     rbo->domains, RADEON_PRIO_MIN) * 4;
 }
 
 static INLINE void r600_emit_reloc(struct r600_common_context *rctx,
index 8ca8dc30b9ff79834a072bac16a4f43e6797ca50..6c54cee4a404a077763b551b7227be275e122256 100644 (file)
@@ -105,7 +105,8 @@ static void send_cmd(struct ruvd_decoder *dec, unsigned cmd,
 {
        int reloc_idx;
 
-       reloc_idx = dec->ws->cs_add_reloc(dec->cs, cs_buf, usage, domain);
+       reloc_idx = dec->ws->cs_add_reloc(dec->cs, cs_buf, usage, domain,
+                                         RADEON_PRIO_MIN);
        set_reg(dec, RUVD_GPCOM_VCPU_DATA0, off);
        set_reg(dec, RUVD_GPCOM_VCPU_DATA1, reloc_idx * 4);
        set_reg(dec, RUVD_GPCOM_VCPU_CMD, cmd << 1);
index 89238ff59926ff51af3bc2594b6ed7fdc91c22f9..80495e5e8d70114437c311718e8ebe9d1db75133 100644 (file)
@@ -34,7 +34,7 @@
 #ifndef RADEON_VCE_H
 #define RADEON_VCE_H
 
-#define RVCE_RELOC(buf, usage, domain) (enc->ws->cs_add_reloc(enc->cs, (buf), (usage), domain))
+#define RVCE_RELOC(buf, usage, domain) (enc->ws->cs_add_reloc(enc->cs, (buf), (usage), domain, RADEON_PRIO_MIN))
 
 #define RVCE_CS(value) (enc->cs->buf[enc->cs->cdw++] = (value))
 #define RVCE_BEGIN(cmd) { uint32_t *begin = &enc->cs->buf[enc->cs->cdw++]; RVCE_CS(cmd)
index 98b7a29427b933658d3346fc70cbaab145062f95..d5bdd516ca05f8260f046647f0c322f9f6ada5f7 100644 (file)
@@ -349,12 +349,13 @@ static unsigned radeon_add_reloc(struct radeon_drm_cs *cs,
 static unsigned radeon_drm_cs_add_reloc(struct radeon_winsys_cs *rcs,
                                         struct radeon_winsys_cs_handle *buf,
                                         enum radeon_bo_usage usage,
-                                        enum radeon_bo_domain domains)
+                                        enum radeon_bo_domain domains,
+                                        enum radeon_bo_priority priority)
 {
     struct radeon_drm_cs *cs = radeon_drm_cs(rcs);
     struct radeon_bo *bo = (struct radeon_bo*)buf;
     enum radeon_bo_domain added_domains;
-    unsigned index = radeon_add_reloc(cs, bo, usage, domains, 0, &added_domains);
+    unsigned index = radeon_add_reloc(cs, bo, usage, domains, priority, &added_domains);
 
     if (added_domains & RADEON_DOMAIN_GTT)
         cs->csc->used_gart += bo->base.size;
@@ -654,7 +655,8 @@ radeon_cs_create_fence(struct radeon_winsys_cs *rcs)
                                        RADEON_DOMAIN_GTT);
     /* Add the fence as a dummy relocation. */
     cs->ws->base.cs_add_reloc(rcs, cs->ws->base.buffer_get_cs_handle(fence),
-                              RADEON_USAGE_READWRITE, RADEON_DOMAIN_GTT);
+                              RADEON_USAGE_READWRITE, RADEON_DOMAIN_GTT,
+                              RADEON_PRIO_MIN);
     return (struct pipe_fence_handle*)fence;
 }
 
index 5b2b31aea48f3c4afed6cb41dbb443cf52d07322..a5461a80048f468d72791bd0c4c013aaa4ce5a6d 100644 (file)
@@ -434,8 +434,8 @@ struct radeon_winsys {
     unsigned (*cs_add_reloc)(struct radeon_winsys_cs *cs,
                              struct radeon_winsys_cs_handle *buf,
                              enum radeon_bo_usage usage,
-                             enum radeon_bo_domain domain/*,
-                             enum radeon_bo_priority priority*/);
+                             enum radeon_bo_domain domain,
+                             enum radeon_bo_priority priority);
 
     /**
      * Return TRUE if there is enough memory in VRAM and GTT for the relocs