mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-19 10:16:16 +07:00
drm/msm: submit support for out-fences
Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
f44d32c79f
commit
4cd0945901
@ -364,6 +364,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
|
|||||||
struct msm_gem_submit *submit;
|
struct msm_gem_submit *submit;
|
||||||
struct msm_gpu *gpu = priv->gpu;
|
struct msm_gpu *gpu = priv->gpu;
|
||||||
struct fence *in_fence = NULL;
|
struct fence *in_fence = NULL;
|
||||||
|
struct sync_file *sync_file = NULL;
|
||||||
|
int out_fence_fd = -1;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -383,6 +385,14 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (args->flags & MSM_SUBMIT_FENCE_FD_OUT) {
|
||||||
|
out_fence_fd = get_unused_fd_flags(O_CLOEXEC);
|
||||||
|
if (out_fence_fd < 0) {
|
||||||
|
ret = out_fence_fd;
|
||||||
|
goto out_unlock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
submit = submit_create(dev, gpu, args->nr_bos, args->nr_cmds);
|
submit = submit_create(dev, gpu, args->nr_bos, args->nr_cmds);
|
||||||
if (!submit) {
|
if (!submit) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
@ -495,10 +505,23 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args->flags & MSM_SUBMIT_FENCE_FD_OUT) {
|
||||||
|
sync_file = sync_file_create(submit->fence);
|
||||||
|
if (!sync_file) {
|
||||||
|
ret = -ENOMEM;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
msm_gpu_submit(gpu, submit, ctx);
|
msm_gpu_submit(gpu, submit, ctx);
|
||||||
|
|
||||||
args->fence = submit->fence->seqno;
|
args->fence = submit->fence->seqno;
|
||||||
|
|
||||||
|
if (args->flags & MSM_SUBMIT_FENCE_FD_OUT) {
|
||||||
|
fd_install(out_fence_fd, sync_file->file);
|
||||||
|
args->fence_fd = out_fence_fd;
|
||||||
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (in_fence)
|
if (in_fence)
|
||||||
fence_put(in_fence);
|
fence_put(in_fence);
|
||||||
@ -506,6 +529,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
|
|||||||
if (ret)
|
if (ret)
|
||||||
msm_gem_submit_free(submit);
|
msm_gem_submit_free(submit);
|
||||||
out_unlock:
|
out_unlock:
|
||||||
|
if (ret && (out_fence_fd >= 0))
|
||||||
|
put_unused_fd(out_fence_fd);
|
||||||
mutex_unlock(&dev->struct_mutex);
|
mutex_unlock(&dev->struct_mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -187,9 +187,11 @@ struct drm_msm_gem_submit_bo {
|
|||||||
/* Valid submit ioctl flags: */
|
/* Valid submit ioctl flags: */
|
||||||
#define MSM_SUBMIT_NO_IMPLICIT 0x80000000 /* disable implicit sync */
|
#define MSM_SUBMIT_NO_IMPLICIT 0x80000000 /* disable implicit sync */
|
||||||
#define MSM_SUBMIT_FENCE_FD_IN 0x40000000 /* enable input fence_fd */
|
#define MSM_SUBMIT_FENCE_FD_IN 0x40000000 /* enable input fence_fd */
|
||||||
|
#define MSM_SUBMIT_FENCE_FD_OUT 0x20000000 /* enable output fence_fd */
|
||||||
#define MSM_SUBMIT_FLAGS ( \
|
#define MSM_SUBMIT_FLAGS ( \
|
||||||
MSM_SUBMIT_NO_IMPLICIT | \
|
MSM_SUBMIT_NO_IMPLICIT | \
|
||||||
MSM_SUBMIT_FENCE_FD_IN | \
|
MSM_SUBMIT_FENCE_FD_IN | \
|
||||||
|
MSM_SUBMIT_FENCE_FD_OUT | \
|
||||||
0)
|
0)
|
||||||
|
|
||||||
/* Each cmdstream submit consists of a table of buffers involved, and
|
/* Each cmdstream submit consists of a table of buffers involved, and
|
||||||
@ -203,7 +205,7 @@ struct drm_msm_gem_submit {
|
|||||||
__u32 nr_cmds; /* in, number of submit_cmd's */
|
__u32 nr_cmds; /* in, number of submit_cmd's */
|
||||||
__u64 __user bos; /* in, ptr to array of submit_bo's */
|
__u64 __user bos; /* in, ptr to array of submit_bo's */
|
||||||
__u64 __user cmds; /* in, ptr to array of submit_cmd's */
|
__u64 __user cmds; /* in, ptr to array of submit_cmd's */
|
||||||
__s32 fence_fd; /* in/out fence fd (see MSM_SUBMIT_FENCE_FD_IN) */
|
__s32 fence_fd; /* in/out fence fd (see MSM_SUBMIT_FENCE_FD_IN/OUT) */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The normal way to synchronize with the GPU is just to CPU_PREP on
|
/* The normal way to synchronize with the GPU is just to CPU_PREP on
|
||||||
|
Loading…
Reference in New Issue
Block a user