Skip to content

Commit

Permalink
drm/msm: Add MSM_SUBMIT_BO_NO_IMPLICIT
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Rob Clark committed Jan 16, 2023
1 parent 03a0a10 commit b1bf64f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/msm/msm_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
* - 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 = {
Expand Down
11 changes: 11 additions & 0 deletions drivers/gpu/drm/msm/msm_gem_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion include/uapi/drm/msm_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit b1bf64f

Please sign in to comment.