summaryrefslogtreecommitdiffstats
path: root/src/freedreno
diff options
context:
space:
mode:
Diffstat (limited to 'src/freedreno')
-rw-r--r--src/freedreno/drm/freedreno_drmif.h1
-rw-r--r--src/freedreno/drm/freedreno_ringbuffer.h1
-rw-r--r--src/freedreno/drm/msm_bo.c7
-rw-r--r--src/freedreno/drm/msm_drm.h24
-rw-r--r--src/freedreno/drm/msm_pipe.c14
-rw-r--r--src/freedreno/drm/msm_ringbuffer_sp.c8
6 files changed, 30 insertions, 25 deletions
diff --git a/src/freedreno/drm/freedreno_drmif.h b/src/freedreno/drm/freedreno_drmif.h
index e12ab970c8f..27ca0a96f26 100644
--- a/src/freedreno/drm/freedreno_drmif.h
+++ b/src/freedreno/drm/freedreno_drmif.h
@@ -85,6 +85,7 @@ enum fd_version {
FD_VERSION_FENCE_FD = 2, /* submit command supports in/out fences */
FD_VERSION_SUBMIT_QUEUES = 3, /* submit queues and multiple priority levels */
FD_VERSION_BO_IOVA = 3, /* supports fd_bo_get/put_iova() */
+ FD_VERSION_SOFTPIN = 4, /* adds softpin, bo name, and dump flag */
};
enum fd_version fd_device_version(struct fd_device *dev);
diff --git a/src/freedreno/drm/freedreno_ringbuffer.h b/src/freedreno/drm/freedreno_ringbuffer.h
index 4292c8f65d6..3ee3e9ba992 100644
--- a/src/freedreno/drm/freedreno_ringbuffer.h
+++ b/src/freedreno/drm/freedreno_ringbuffer.h
@@ -124,6 +124,7 @@ struct fd_reloc {
struct fd_bo *bo;
#define FD_RELOC_READ 0x0001
#define FD_RELOC_WRITE 0x0002
+#define FD_RELOC_DUMP 0x0004
uint32_t flags;
uint32_t offset;
uint32_t or;
diff --git a/src/freedreno/drm/msm_bo.c b/src/freedreno/drm/msm_bo.c
index d93dfbeab2e..95f888b6cf6 100644
--- a/src/freedreno/drm/msm_bo.c
+++ b/src/freedreno/drm/msm_bo.c
@@ -32,6 +32,7 @@ static int bo_allocate(struct msm_bo *msm_bo)
if (!msm_bo->offset) {
struct drm_msm_gem_info req = {
.handle = bo->handle,
+ .info = MSM_INFO_GET_OFFSET,
};
int ret;
@@ -46,7 +47,7 @@ static int bo_allocate(struct msm_bo *msm_bo)
return ret;
}
- msm_bo->offset = req.offset;
+ msm_bo->offset = req.value;
}
return 0;
@@ -106,14 +107,14 @@ static uint64_t msm_bo_iova(struct fd_bo *bo)
{
struct drm_msm_gem_info req = {
.handle = bo->handle,
- .flags = MSM_INFO_IOVA,
+ .info = MSM_INFO_GET_IOVA,
};
int ret;
ret = drmCommandWriteRead(bo->dev->fd, DRM_MSM_GEM_INFO, &req, sizeof(req));
debug_assert(ret == 0);
- return req.offset;
+ return req.value;
}
static void msm_bo_destroy(struct fd_bo *bo)
diff --git a/src/freedreno/drm/msm_drm.h b/src/freedreno/drm/msm_drm.h
index c06d0a5bdd8..09f16fd7bed 100644
--- a/src/freedreno/drm/msm_drm.h
+++ b/src/freedreno/drm/msm_drm.h
@@ -105,14 +105,23 @@ struct drm_msm_gem_new {
__u32 handle; /* out */
};
-#define MSM_INFO_IOVA 0x01
-
-#define MSM_INFO_FLAGS (MSM_INFO_IOVA)
+/* Get or set GEM buffer info. The requested value can be passed
+ * directly in 'value', or for data larger than 64b 'value' is a
+ * pointer to userspace buffer, with 'len' specifying the number of
+ * bytes copied into that buffer. For info returned by pointer,
+ * calling the GEM_INFO ioctl with null 'value' will return the
+ * required buffer size in 'len'
+ */
+#define MSM_INFO_GET_OFFSET 0x00 /* get mmap() offset, returned by value */
+#define MSM_INFO_GET_IOVA 0x01 /* get iova, returned by value */
+#define MSM_INFO_SET_NAME 0x02 /* set the debug name (by pointer) */
+#define MSM_INFO_GET_NAME 0x03 /* get debug name, returned by pointer */
struct drm_msm_gem_info {
__u32 handle; /* in */
- __u32 flags; /* in - combination of MSM_INFO_* flags */
- __u64 offset; /* out, mmap() offset or iova */
+ __u32 info; /* in - one of MSM_INFO_* */
+ __u64 value; /* in or out */
+ __u32 len; /* in or out */
};
#define MSM_PREP_READ 0x01
@@ -188,8 +197,11 @@ struct drm_msm_gem_submit_cmd {
*/
#define MSM_SUBMIT_BO_READ 0x0001
#define MSM_SUBMIT_BO_WRITE 0x0002
+#define MSM_SUBMIT_BO_DUMP 0x0004
-#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | MSM_SUBMIT_BO_WRITE)
+#define MSM_SUBMIT_BO_FLAGS (MSM_SUBMIT_BO_READ | \
+ MSM_SUBMIT_BO_WRITE | \
+ MSM_SUBMIT_BO_DUMP)
struct drm_msm_gem_submit_bo {
__u32 flags; /* in, mask of MSM_SUBMIT_BO_x */
diff --git a/src/freedreno/drm/msm_pipe.c b/src/freedreno/drm/msm_pipe.c
index 13defc6d917..7d5b9fcd76f 100644
--- a/src/freedreno/drm/msm_pipe.c
+++ b/src/freedreno/drm/msm_pipe.c
@@ -168,16 +168,6 @@ static uint64_t get_param(struct fd_pipe *pipe, uint32_t param)
return value;
}
-static bool use_softpin(void)
-{
- static int sp = -1;
- if (sp < 0) {
- const char *str = getenv("FD_MESA_DEBUG");
- sp = str && strstr(str, "softpin");
- }
- return sp;
-}
-
struct fd_pipe * msm_pipe_new(struct fd_device *dev,
enum fd_pipe_id id, uint32_t prio)
{
@@ -196,9 +186,7 @@ struct fd_pipe * msm_pipe_new(struct fd_device *dev,
pipe = &msm_pipe->base;
- // TODO once kernel changes are in place, this switch will be
- // based on kernel version:
- if (use_softpin()) {
+ if (fd_device_version(dev) >= FD_VERSION_SOFTPIN) {
pipe->funcs = &sp_funcs;
} else {
pipe->funcs = &legacy_funcs;
diff --git a/src/freedreno/drm/msm_ringbuffer_sp.c b/src/freedreno/drm/msm_ringbuffer_sp.c
index 8e4e4a5a18c..228740d783b 100644
--- a/src/freedreno/drm/msm_ringbuffer_sp.c
+++ b/src/freedreno/drm/msm_ringbuffer_sp.c
@@ -156,6 +156,8 @@ append_bo(struct msm_submit_sp *submit, struct fd_bo *bo, uint32_t flags)
submit->submit_bos[idx].flags |= MSM_SUBMIT_BO_READ;
if (flags & FD_RELOC_WRITE)
submit->submit_bos[idx].flags |= MSM_SUBMIT_BO_WRITE;
+ if (flags & FD_RELOC_DUMP)
+ submit->submit_bos[idx].flags |= MSM_SUBMIT_BO_DUMP;
return idx;
}
@@ -257,8 +259,8 @@ msm_submit_sp_flush(struct fd_submit *submit, int in_fence_fd,
for (unsigned i = 0; i < primary->u.nr_cmds; i++) {
cmds[i].type = MSM_SUBMIT_CMD_BUF;
- cmds[i].submit_idx =
- append_bo(msm_submit, primary->u.cmds[i].ring_bo, FD_RELOC_READ);
+ cmds[i].submit_idx = append_bo(msm_submit,
+ primary->u.cmds[i].ring_bo, FD_RELOC_READ | FD_RELOC_DUMP);
cmds[i].submit_offset = primary->offset;
cmds[i].size = primary->u.cmds[i].size;
cmds[i].pad = 0;
@@ -447,7 +449,7 @@ msm_ringbuffer_sp_emit_reloc_ring(struct fd_ringbuffer *ring,
msm_ringbuffer_sp_emit_reloc(ring, &(struct fd_reloc){
.bo = bo,
- .flags = FD_RELOC_READ,
+ .flags = FD_RELOC_READ | FD_RELOC_DUMP,
.offset = msm_target->offset,
});