aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'freedreno/msm/msm_pipe.c')
-rw-r--r--freedreno/msm/msm_pipe.c41
1 files changed, 40 insertions, 1 deletions
diff --git a/freedreno/msm/msm_pipe.c b/freedreno/msm/msm_pipe.c
index f872e245..7395e573 100644
--- a/freedreno/msm/msm_pipe.c
+++ b/freedreno/msm/msm_pipe.c
@@ -71,6 +71,8 @@ static int msm_pipe_get_param(struct fd_pipe *pipe,
71 return query_param(pipe, MSM_PARAM_MAX_FREQ, value); 71 return query_param(pipe, MSM_PARAM_MAX_FREQ, value);
72 case FD_TIMESTAMP: 72 case FD_TIMESTAMP:
73 return query_param(pipe, MSM_PARAM_TIMESTAMP, value); 73 return query_param(pipe, MSM_PARAM_TIMESTAMP, value);
74 case FD_NR_RINGS:
75 return query_param(pipe, MSM_PARAM_NR_RINGS, value);
74 default: 76 default:
75 ERROR_MSG("invalid param id: %d", param); 77 ERROR_MSG("invalid param id: %d", param);
76 return -1; 78 return -1;
@@ -83,6 +85,7 @@ static int msm_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp,
83 struct fd_device *dev = pipe->dev; 85 struct fd_device *dev = pipe->dev;
84 struct drm_msm_wait_fence req = { 86 struct drm_msm_wait_fence req = {
85 .fence = timestamp, 87 .fence = timestamp,
88 .queueid = to_msm_pipe(pipe)->queue_id,
86 }; 89 };
87 int ret; 90 int ret;
88 91
@@ -97,9 +100,42 @@ static int msm_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp,
97 return 0; 100 return 0;
98} 101}
99 102
103static int open_submitqueue(struct fd_device *dev, uint32_t prio,
104 uint32_t *queue_id)
105{
106 struct drm_msm_submitqueue req = {
107 .flags = 0,
108 .prio = prio,
109 };
110 int ret;
111
112 if (fd_device_version(dev) < FD_VERSION_SUBMIT_QUEUES) {
113 *queue_id = 0;
114 return 0;
115 }
116
117 ret = drmCommandWriteRead(dev->fd, DRM_MSM_SUBMITQUEUE_NEW, &req, sizeof(req));
118 if (ret) {
119 ERROR_MSG("could not create submitqueue! %d (%s)", ret, strerror(errno));
120 return ret;
121 }
122
123 *queue_id = req.id;
124 return 0;
125}
126
127static void close_submitqueue(struct fd_device *dev, uint32_t queue_id)
128{
129 if (fd_device_version(dev) < FD_VERSION_SUBMIT_QUEUES)
130 return;
131
132 drmCommandWrite(dev->fd, DRM_MSM_SUBMITQUEUE_CLOSE, &queue_id, sizeof(queue_id));
133}
134
100static void msm_pipe_destroy(struct fd_pipe *pipe) 135static void msm_pipe_destroy(struct fd_pipe *pipe)
101{ 136{
102 struct msm_pipe *msm_pipe = to_msm_pipe(pipe); 137 struct msm_pipe *msm_pipe = to_msm_pipe(pipe);
138 close_submitqueue(pipe->dev, msm_pipe->queue_id);
103 free(msm_pipe); 139 free(msm_pipe);
104} 140}
105 141
@@ -122,7 +158,7 @@ static uint64_t get_param(struct fd_pipe *pipe, uint32_t param)
122} 158}
123 159
124drm_private struct fd_pipe * msm_pipe_new(struct fd_device *dev, 160drm_private struct fd_pipe * msm_pipe_new(struct fd_device *dev,
125 enum fd_pipe_id id) 161 enum fd_pipe_id id, uint32_t prio)
126{ 162{
127 static const uint32_t pipe_id[] = { 163 static const uint32_t pipe_id[] = {
128 [FD_PIPE_3D] = MSM_PIPE_3D0, 164 [FD_PIPE_3D] = MSM_PIPE_3D0,
@@ -157,6 +193,9 @@ drm_private struct fd_pipe * msm_pipe_new(struct fd_device *dev,
157 INFO_MSG(" Chip-id: 0x%08x", msm_pipe->chip_id); 193 INFO_MSG(" Chip-id: 0x%08x", msm_pipe->chip_id);
158 INFO_MSG(" GMEM size: 0x%08x", msm_pipe->gmem); 194 INFO_MSG(" GMEM size: 0x%08x", msm_pipe->gmem);
159 195
196 if (open_submitqueue(dev, prio, &msm_pipe->queue_id))
197 goto fail;
198
160 return pipe; 199 return pipe;
161fail: 200fail:
162 if (pipe) 201 if (pipe)