mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 23:14:31 +08:00
drm/vc4: Syncobj import support
Allow userland to specify a syncobj that is waited on before a render job starts processing. v2: Use 0 as invalid syncobj to drop flag (Eric) Drop extra newline (Eric) Signed-off-by: Stefan Schake <stschake@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/1524607427-12876-2-git-send-email-stschake@gmail.com
This commit is contained in:
parent
3481fe768f
commit
818f5c8f4c
@ -11,6 +11,7 @@
|
|||||||
#include <drm/drm_encoder.h>
|
#include <drm/drm_encoder.h>
|
||||||
#include <drm/drm_gem_cma_helper.h>
|
#include <drm/drm_gem_cma_helper.h>
|
||||||
#include <drm/drm_atomic.h>
|
#include <drm/drm_atomic.h>
|
||||||
|
#include <drm/drm_syncobj.h>
|
||||||
|
|
||||||
#include "uapi/drm/vc4_drm.h"
|
#include "uapi/drm/vc4_drm.h"
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/sched/signal.h>
|
#include <linux/sched/signal.h>
|
||||||
|
#include <linux/dma-fence-array.h>
|
||||||
|
|
||||||
#include "uapi/drm/vc4_drm.h"
|
#include "uapi/drm/vc4_drm.h"
|
||||||
#include "vc4_drv.h"
|
#include "vc4_drv.h"
|
||||||
@ -1115,6 +1116,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
|
|||||||
struct drm_vc4_submit_cl *args = data;
|
struct drm_vc4_submit_cl *args = data;
|
||||||
struct vc4_exec_info *exec;
|
struct vc4_exec_info *exec;
|
||||||
struct ww_acquire_ctx acquire_ctx;
|
struct ww_acquire_ctx acquire_ctx;
|
||||||
|
struct dma_fence *in_fence;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if ((args->flags & ~(VC4_SUBMIT_CL_USE_CLEAR_COLOR |
|
if ((args->flags & ~(VC4_SUBMIT_CL_USE_CLEAR_COLOR |
|
||||||
@ -1125,11 +1127,6 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->pad2 != 0) {
|
|
||||||
DRM_DEBUG("->pad2 must be set to zero\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
exec = kcalloc(1, sizeof(*exec), GFP_KERNEL);
|
exec = kcalloc(1, sizeof(*exec), GFP_KERNEL);
|
||||||
if (!exec) {
|
if (!exec) {
|
||||||
DRM_ERROR("malloc failure on exec struct\n");
|
DRM_ERROR("malloc failure on exec struct\n");
|
||||||
@ -1164,6 +1161,29 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args->in_sync) {
|
||||||
|
ret = drm_syncobj_find_fence(file_priv, args->in_sync,
|
||||||
|
&in_fence);
|
||||||
|
if (ret)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
/* When the fence (or fence array) is exclusively from our
|
||||||
|
* context we can skip the wait since jobs are executed in
|
||||||
|
* order of their submission through this ioctl and this can
|
||||||
|
* only have fences from a prior job.
|
||||||
|
*/
|
||||||
|
if (!dma_fence_match_context(in_fence,
|
||||||
|
vc4->dma_fence_context)) {
|
||||||
|
ret = dma_fence_wait(in_fence, true);
|
||||||
|
if (ret) {
|
||||||
|
dma_fence_put(in_fence);
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dma_fence_put(in_fence);
|
||||||
|
}
|
||||||
|
|
||||||
if (exec->args->bin_cl_size != 0) {
|
if (exec->args->bin_cl_size != 0) {
|
||||||
ret = vc4_get_bcl(dev, exec);
|
ret = vc4_get_bcl(dev, exec);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -183,11 +183,10 @@ struct drm_vc4_submit_cl {
|
|||||||
/* ID of the perfmon to attach to this job. 0 means no perfmon. */
|
/* ID of the perfmon to attach to this job. 0 means no perfmon. */
|
||||||
__u32 perfmonid;
|
__u32 perfmonid;
|
||||||
|
|
||||||
/* Unused field to align this struct on 64 bits. Must be set to 0.
|
/* Syncobj handle to wait on. If set, processing of this render job
|
||||||
* If one ever needs to add an u32 field to this struct, this field
|
* will not start until the syncobj is signaled. 0 means ignore.
|
||||||
* can be used.
|
|
||||||
*/
|
*/
|
||||||
__u32 pad2;
|
__u32 in_sync;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user