History

drm/msm/a6xx: Add a flag to allow preemption to submitqueue_create

Some userspace changes are necessary so add a flag for userspace to advertise support for preemption when creating the submitqueue. When this flag is not set preemption will not be allowed in the middle of the submitted IBs therefore mantaining compatibility with older userspace. The flag is rejected if preemption is not supported on the target, this allows userspace to know whether preemption is supported.

Antonino Maniscalco committed 2 years ago

Commit 7788d321 parent 35d36dc3 files · +15 −5Browse files

Unified · Split

3 files
  1. drivers/gpu/drm/msm/adreno/a6xx_gpu.c +8 −4
  2. drivers/gpu/drm/msm/msm_submitqueue.c +3 −0
  3. include/uapi/drm/msm_drm.h +4 −1
drivers/gpu/drm/msm/adreno/a6xx_gpu.c+8−4
@@ -352,8 +352,10 @@ static void a7xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) · 351 unmodified lines
352352 OUT_PKT7(ring, CP_SET_MARKER, 1);
353353 OUT_RING(ring, 0x101); /* IFPC disable */
354354
355− OUT_PKT7(ring, CP_SET_MARKER, 1);
356− OUT_RING(ring, 0x00d); /* IB1LIST start */
355+ if (submit->queue->flags & MSM_SUBMITQUEUE_ALLOW_PREEMPT) {
356+ OUT_PKT7(ring, CP_SET_MARKER, 1);
357+ OUT_RING(ring, 0x00d); /* IB1LIST start */
358+ }
357359
358360 /* Submit the commands */
359361 for (i = 0; i < submit->nr_cmds; i++) {
@@ -384,8 +386,10 @@ static void a7xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) · 24 unmodified lines
384386 update_shadow_rptr(gpu, ring);
385387 }
386388
387− OUT_PKT7(ring, CP_SET_MARKER, 1);
388− OUT_RING(ring, 0x00e); /* IB1LIST end */
389+ if (submit->queue->flags & MSM_SUBMITQUEUE_ALLOW_PREEMPT) {
390+ OUT_PKT7(ring, CP_SET_MARKER, 1);
391+ OUT_RING(ring, 0x00e); /* IB1LIST end */
392+ }
389393
390394 get_stats_counter(ring, REG_A7XX_RBBM_PERFCTR_CP(0),
391395 rbmemptr_stats(ring, index, cpcycles_end));
drivers/gpu/drm/msm/msm_submitqueue.c+3−0
@@ -170,6 +170,9 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx, · 169 unmodified lines
170170 if (!priv->gpu)
171171 return -ENODEV;
172172
173+ if (flags & MSM_SUBMITQUEUE_ALLOW_PREEMPT && priv->gpu->nr_rings == 1)
174+ return -EINVAL;
175+
173176 ret = msm_gpu_convert_priority(priv->gpu, prio, &ring_nr, &sched_prio);
174177 if (ret)
175178 return ret;
include/uapi/drm/msm_drm.h+4−1
@@ -347,7 +347,10 @@ struct drm_msm_gem_madvise { · 346 unmodified lines
347347 * backwards compatibility as a "default" submitqueue
348348 */
349349
350−#define MSM_SUBMITQUEUE_FLAGS (0)
350+#define MSM_SUBMITQUEUE_ALLOW_PREEMPT 0x00000001
351+#define MSM_SUBMITQUEUE_FLAGS ( \
352+ MSM_SUBMITQUEUE_ALLOW_PREEMPT | \
353+ 0)
351354
352355 /*
353356 * The submitqueue priority should be between 0 and MSM_PARAM_PRIORITIES-1,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t