summaryrefslogtreecommitdiffstats
path: root/src/freedreno
diff options
context:
space:
mode:
authorJonathan Marek <[email protected]>2020-02-27 11:18:45 -0500
committerMarge Bot <[email protected]>2020-02-28 14:04:20 +0000
commitcf302c9a22fab86da0bc70f377c8f0c43f5d8d77 (patch)
treed7df740bd241fd97f51050e6fd73228d8c3dfd2e /src/freedreno
parent6420406f197cc4f1170c340e839701aeb253fdf0 (diff)
turnip: don't hardcode gmem base for input attachment
Newer a6xx no longer has programmable GMEM base, so we can't rely on the kernel driver setting it to 0x100000 (GMEM base is 0 on such GPUs). Signed-off-by: Jonathan Marek <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3979>
Diffstat (limited to 'src/freedreno')
-rw-r--r--src/freedreno/vulkan/tu_cmd_buffer.c2
-rw-r--r--src/freedreno/vulkan/tu_device.c8
-rw-r--r--src/freedreno/vulkan/tu_drm.c6
-rw-r--r--src/freedreno/vulkan/tu_private.h4
4 files changed, 19 insertions, 1 deletions
diff --git a/src/freedreno/vulkan/tu_cmd_buffer.c b/src/freedreno/vulkan/tu_cmd_buffer.c
index d24e869daf2..f8e1ffe1c9d 100644
--- a/src/freedreno/vulkan/tu_cmd_buffer.c
+++ b/src/freedreno/vulkan/tu_cmd_buffer.c
@@ -2771,7 +2771,7 @@ write_tex_const(struct tu_cmd_buffer *cmd,
A6XX_TEX_CONST_2_TYPE(A6XX_TEX_2D) |
A6XX_TEX_CONST_2_PITCH(tiling->tile0.extent.width * att->cpp);
dst[3] = 0;
- dst[4] = 0x100000 + att->gmem_offset;
+ dst[4] = cmd->device->physical_device->gmem_base + att->gmem_offset;
dst[5] = A6XX_TEX_CONST_5_DEPTH(1);
for (unsigned i = 6; i < A6XX_TEX_CONST_DWORDS; i++)
dst[i] = 0;
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index f78de1bfd4c..8c0459f4680 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -252,6 +252,14 @@ tu_physical_device_init(struct tu_physical_device *device,
goto fail;
}
+ if (tu_drm_get_gmem_base(device, &device->gmem_base)) {
+ if (instance->debug_flags & TU_DEBUG_STARTUP)
+ tu_logi("Could not query the GMEM size");
+ result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
+ "could not get GMEM size");
+ goto fail;
+ }
+
memset(device->name, 0, sizeof(device->name));
sprintf(device->name, "FD%d", device->gpu_id);
diff --git a/src/freedreno/vulkan/tu_drm.c b/src/freedreno/vulkan/tu_drm.c
index 9b2e6f78879..5e91adaf89e 100644
--- a/src/freedreno/vulkan/tu_drm.c
+++ b/src/freedreno/vulkan/tu_drm.c
@@ -80,6 +80,12 @@ tu_drm_get_gmem_size(const struct tu_physical_device *dev, uint32_t *size)
}
int
+tu_drm_get_gmem_base(const struct tu_physical_device *dev, uint64_t *base)
+{
+ return tu_drm_get_param(dev, MSM_PARAM_GMEM_BASE, base);
+}
+
+int
tu_drm_submitqueue_new(const struct tu_device *dev,
int priority,
uint32_t *queue_id)
diff --git a/src/freedreno/vulkan/tu_private.h b/src/freedreno/vulkan/tu_private.h
index f0b6943f465..d076df1fdbc 100644
--- a/src/freedreno/vulkan/tu_private.h
+++ b/src/freedreno/vulkan/tu_private.h
@@ -313,6 +313,7 @@ struct tu_physical_device
unsigned gpu_id;
uint32_t gmem_size;
+ uint64_t gmem_base;
uint32_t tile_align_w;
uint32_t tile_align_h;
@@ -1625,6 +1626,9 @@ int
tu_drm_get_gmem_size(const struct tu_physical_device *dev, uint32_t *size);
int
+tu_drm_get_gmem_base(const struct tu_physical_device *dev, uint64_t *base);
+
+int
tu_drm_submitqueue_new(const struct tu_device *dev,
int priority,
uint32_t *queue_id);