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.
Unified · Split
| @@ -352,8 +352,10 @@ static void a7xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) · 351 unmodified lines | ||
| 352 | 352 | OUT_PKT7(ring, CP_SET_MARKER, 1); |
| 353 | 353 | OUT_RING(ring, 0x101); /* IFPC disable */ |
| 354 | 354 | |
| 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 | + } | |
| 357 | 359 | |
| 358 | 360 | /* Submit the commands */ |
| 359 | 361 | 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 | ||
| 384 | 386 | update_shadow_rptr(gpu, ring); |
| 385 | 387 | } |
| 386 | 388 | |
| 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 | + } | |
| 389 | 393 | |
| 390 | 394 | get_stats_counter(ring, REG_A7XX_RBBM_PERFCTR_CP(0), |
| 391 | 395 | rbmemptr_stats(ring, index, cpcycles_end)); |
| @@ -170,6 +170,9 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx, · 169 unmodified lines | ||
| 170 | 170 | if (!priv->gpu) |
| 171 | 171 | return -ENODEV; |
| 172 | 172 | |
| 173 | + if (flags & MSM_SUBMITQUEUE_ALLOW_PREEMPT && priv->gpu->nr_rings == 1) | |
| 174 | + return -EINVAL; | |
| 175 | + | |
| 173 | 176 | ret = msm_gpu_convert_priority(priv->gpu, prio, &ring_nr, &sched_prio); |
| 174 | 177 | if (ret) |
| 175 | 178 | return ret; |
| @@ -347,7 +347,10 @@ struct drm_msm_gem_madvise { · 346 unmodified lines | ||
| 347 | 347 | * backwards compatibility as a "default" submitqueue |
| 348 | 348 | */ |
| 349 | 349 | |
| 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) | |
| 351 | 354 | |
| 352 | 355 | /* |
| 353 | 356 | * The submitqueue priority should be between 0 and MSM_PARAM_PRIORITIES-1, |