drm/msm: Add MSM_SUBMIT_BO_NO_IMPLICIT
authorRob Clark <robdclark@chromium.org>
Tue, 6 Dec 2022 19:21:23 +0000 (11:21 -0800)
committerRob Clark <robdclark@chromium.org>
Mon, 16 Jan 2023 18:33:57 +0000 (10:33 -0800)
In cases where implicit sync is used, it is still useful (for things
like sub-allocation, etc) to allow userspace to opt-out of implicit
sync on per-BO basis.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/514216/
Link: https://lore.kernel.org/r/20221206192123.661448-1-robdclark@gmail.com
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_gem_submit.c
include/uapi/drm/msm_drm.h

index 8b0b0ac74a6f1d140143f785887868533d39c434..c86af9ccb7f4a11786e3c9eac6d3ed2954cf655a 100644 (file)
  * - 1.7.0 - Add MSM_PARAM_SUSPENDS to access suspend count
  * - 1.8.0 - Add MSM_BO_CACHED_COHERENT for supported GPUs (a6xx)
  * - 1.9.0 - Add MSM_SUBMIT_FENCE_SN_IN
+ * - 1.10.0 - Add MSM_SUBMIT_BO_NO_IMPLICIT
  */
 #define MSM_VERSION_MAJOR      1
-#define MSM_VERSION_MINOR      9
+#define MSM_VERSION_MINOR      10
 #define MSM_VERSION_PATCHLEVEL 0
 
 static const struct drm_mode_config_funcs mode_config_funcs = {
index 73a2ca122c57027869846231eecf43959904fb8e..1af7e7c613a6fea33c0a0a0e3bb9122050aab3d9 100644 (file)
@@ -334,9 +334,20 @@ static int submit_fence_sync(struct msm_gem_submit *submit, bool no_implicit)
                if (ret)
                        return ret;
 
+               /* If userspace has determined that explicit fencing is
+                * used, it can disable implicit sync on the entire
+                * submit:
+                */
                if (no_implicit)
                        continue;
 
+               /* Otherwise userspace can ask for implicit sync to be
+                * disabled on specific buffers.  This is useful for internal
+                * usermode driver managed buffers, suballocation, etc.
+                */
+               if (submit->bos[i].flags & MSM_SUBMIT_BO_NO_IMPLICIT)
+                       continue;
+
                ret = drm_sched_job_add_implicit_dependencies(&submit->base,
                                                              obj,
                                                              write);
index f54b48ef6a2d81c023c4562c876584db06352683..329100016e7cc23c79a43f3bdd6daa616f052122 100644 (file)
@@ -222,10 +222,12 @@ 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_NO_IMPLICIT      0x0008
 
 #define MSM_SUBMIT_BO_FLAGS            (MSM_SUBMIT_BO_READ | \
                                        MSM_SUBMIT_BO_WRITE | \
-                                       MSM_SUBMIT_BO_DUMP)
+                                       MSM_SUBMIT_BO_DUMP | \
+                                       MSM_SUBMIT_BO_NO_IMPLICIT)
 
 struct drm_msm_gem_submit_bo {
        __u32 flags;          /* in, mask of MSM_SUBMIT_BO_x */