aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorChristian König <[email protected]>2014-04-09 19:41:06 +0200
committerMarek Olšák <[email protected]>2015-08-14 15:02:30 +0200
commit0248c13a8b1e10e2c8c8d614473c701239627a71 (patch)
treeed36651ee4f9c3574ce1f54b7eb1fc284fb742dd /src/gallium
parent767ad50a10d01274b1d1a877add12b5552ba6984 (diff)
gallium/radeon: use VM for UVD
v2: (leo) add checking for driver backend v3: (leo) change variable name from use_amdgpu to use_vm v4: rebase by Marek Signed-off-by: Christian König <[email protected]> Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/radeon/radeon_uvd.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/gallium/drivers/radeon/radeon_uvd.c b/src/gallium/drivers/radeon/radeon_uvd.c
index 79fc0c726c4..b203e64f815 100644
--- a/src/gallium/drivers/radeon/radeon_uvd.c
+++ b/src/gallium/drivers/radeon/radeon_uvd.c
@@ -82,6 +82,7 @@ struct ruvd_decoder {
unsigned bs_size;
struct rvid_buffer dpb;
+ bool use_legacy;
};
/* flush IB to the hardware */
@@ -107,8 +108,16 @@ static void send_cmd(struct ruvd_decoder *dec, unsigned cmd,
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);
+ if (!dec->use_legacy) {
+ uint64_t addr;
+ addr = dec->ws->buffer_get_virtual_address(cs_buf);
+ addr = addr + off;
+ set_reg(dec, RUVD_GPCOM_VCPU_DATA0, addr);
+ set_reg(dec, RUVD_GPCOM_VCPU_DATA1, addr >> 32);
+ } else {
+ 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);
}
@@ -792,6 +801,9 @@ struct pipe_video_codec *ruvd_create_decoder(struct pipe_context *context,
if (!dec)
return NULL;
+ if (info.drm_major < 3)
+ dec->use_legacy = TRUE;
+
dec->base = *templ;
dec->base.context = context;
dec->base.width = width;