[Mesa-dev] [PATCH 6/7] r300g, uvd, vce: set priorities for relocations
Marek Olšák
maraeo at gmail.com
Mon Feb 24 15:48:33 PST 2014
From: Marek Olšák <marek.olsak at amd.com>
This updates all occurences of cs_add_reloc.
---
src/gallium/drivers/r300/r300_emit.c | 27 +++++++++++++++++++--------
src/gallium/drivers/radeon/r600_cs.h | 3 ++-
src/gallium/drivers/radeon/radeon_uvd.c | 3 ++-
src/gallium/drivers/radeon/radeon_vce.h | 2 +-
src/gallium/winsys/radeon/drm/radeon_drm_cs.c | 8 +++++---
src/gallium/winsys/radeon/drm/radeon_winsys.h | 4 ++--
6 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index b038a97..d99b919 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -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)) {
diff --git a/src/gallium/drivers/radeon/r600_cs.h b/src/gallium/drivers/radeon/r600_cs.h
index c3af3de..45dc76c 100644
--- a/src/gallium/drivers/radeon/r600_cs.h
+++ b/src/gallium/drivers/radeon/r600_cs.h
@@ -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,
diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
index 3075905..162457e 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -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);
diff --git a/src/gallium/drivers/radeon/radeon_vce.h b/src/gallium/drivers/radeon/radeon_vce.h
index 89238ff..80495e5 100644
--- a/src/gallium/drivers/radeon/radeon_vce.h
+++ b/src/gallium/drivers/radeon/radeon_vce.h
@@ -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)
diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
index a25a7d7..fec3484 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_cs.c
@@ -366,12 +366,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;
@@ -673,7 +674,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;
}
diff --git a/src/gallium/winsys/radeon/drm/radeon_winsys.h b/src/gallium/winsys/radeon/drm/radeon_winsys.h
index 650df4e..2273cfd 100644
--- a/src/gallium/winsys/radeon/drm/radeon_winsys.h
+++ b/src/gallium/winsys/radeon/drm/radeon_winsys.h
@@ -449,8 +449,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
--
1.8.3.2
More information about the mesa-dev
mailing list