Commit c5195d00 authored by Maíra Canal's avatar Maíra Canal

drm/v3d: Use v3d_get_extensions() to parse CPU job data

Currently, v3d_get_extensions() only parses multisync data and assigns
it to the `struct v3d_submit_ext`. But, to implement the CPU job with
user extensions, we want v3d_get_extensions() to be able to parse CPU
job data and assign it to the `struct v3d_cpu_job`.

Therefore, allow the function v3d_get_extensions() to use `struct v3d_cpu_job *`
as a parameter. If the `struct v3d_cpu_job *` is assigned to NULL, it means
that the job is a GPU job and CPU job extensions should be rejected.
Signed-off-by: default avatarMaíra Canal <mcanal@igalia.com>
Reviewed-by: default avatarIago Toral Quiroga <itoral@igalia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231130164420.932823-10-mcanal@igalia.com
parent aafc1a2b
...@@ -323,10 +323,9 @@ v3d_get_multisync_post_deps(struct drm_file *file_priv, ...@@ -323,10 +323,9 @@ v3d_get_multisync_post_deps(struct drm_file *file_priv,
static int static int
v3d_get_multisync_submit_deps(struct drm_file *file_priv, v3d_get_multisync_submit_deps(struct drm_file *file_priv,
struct drm_v3d_extension __user *ext, struct drm_v3d_extension __user *ext,
void *data) struct v3d_submit_ext *se)
{ {
struct drm_v3d_multi_sync multisync; struct drm_v3d_multi_sync multisync;
struct v3d_submit_ext *se = data;
int ret; int ret;
if (se->in_sync_count || se->out_sync_count) { if (se->in_sync_count || se->out_sync_count) {
...@@ -340,7 +339,7 @@ v3d_get_multisync_submit_deps(struct drm_file *file_priv, ...@@ -340,7 +339,7 @@ v3d_get_multisync_submit_deps(struct drm_file *file_priv,
if (multisync.pad) if (multisync.pad)
return -EINVAL; return -EINVAL;
ret = v3d_get_multisync_post_deps(file_priv, data, multisync.out_sync_count, ret = v3d_get_multisync_post_deps(file_priv, se, multisync.out_sync_count,
multisync.out_syncs); multisync.out_syncs);
if (ret) if (ret)
return ret; return ret;
...@@ -359,7 +358,8 @@ v3d_get_multisync_submit_deps(struct drm_file *file_priv, ...@@ -359,7 +358,8 @@ v3d_get_multisync_submit_deps(struct drm_file *file_priv,
static int static int
v3d_get_extensions(struct drm_file *file_priv, v3d_get_extensions(struct drm_file *file_priv,
u64 ext_handles, u64 ext_handles,
void *data) struct v3d_submit_ext *se,
struct v3d_cpu_job *job)
{ {
struct drm_v3d_extension __user *user_ext; struct drm_v3d_extension __user *user_ext;
int ret; int ret;
...@@ -375,15 +375,16 @@ v3d_get_extensions(struct drm_file *file_priv, ...@@ -375,15 +375,16 @@ v3d_get_extensions(struct drm_file *file_priv,
switch (ext.id) { switch (ext.id) {
case DRM_V3D_EXT_ID_MULTI_SYNC: case DRM_V3D_EXT_ID_MULTI_SYNC:
ret = v3d_get_multisync_submit_deps(file_priv, user_ext, data); ret = v3d_get_multisync_submit_deps(file_priv, user_ext, se);
if (ret)
return ret;
break; break;
default: default:
DRM_DEBUG_DRIVER("Unknown extension id: %d\n", ext.id); DRM_DEBUG_DRIVER("Unknown extension id: %d\n", ext.id);
return -EINVAL; return -EINVAL;
} }
if (ret)
return ret;
user_ext = u64_to_user_ptr(ext.next); user_ext = u64_to_user_ptr(ext.next);
} }
...@@ -430,7 +431,7 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data, ...@@ -430,7 +431,7 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
} }
if (args->flags & DRM_V3D_SUBMIT_EXTENSION) { if (args->flags & DRM_V3D_SUBMIT_EXTENSION) {
ret = v3d_get_extensions(file_priv, args->extensions, &se); ret = v3d_get_extensions(file_priv, args->extensions, &se, NULL);
if (ret) { if (ret) {
DRM_DEBUG("Failed to get extensions.\n"); DRM_DEBUG("Failed to get extensions.\n");
return ret; return ret;
...@@ -585,7 +586,7 @@ v3d_submit_tfu_ioctl(struct drm_device *dev, void *data, ...@@ -585,7 +586,7 @@ v3d_submit_tfu_ioctl(struct drm_device *dev, void *data,
} }
if (args->flags & DRM_V3D_SUBMIT_EXTENSION) { if (args->flags & DRM_V3D_SUBMIT_EXTENSION) {
ret = v3d_get_extensions(file_priv, args->extensions, &se); ret = v3d_get_extensions(file_priv, args->extensions, &se, NULL);
if (ret) { if (ret) {
DRM_DEBUG("Failed to get extensions.\n"); DRM_DEBUG("Failed to get extensions.\n");
return ret; return ret;
...@@ -692,7 +693,7 @@ v3d_submit_csd_ioctl(struct drm_device *dev, void *data, ...@@ -692,7 +693,7 @@ v3d_submit_csd_ioctl(struct drm_device *dev, void *data,
} }
if (args->flags & DRM_V3D_SUBMIT_EXTENSION) { if (args->flags & DRM_V3D_SUBMIT_EXTENSION) {
ret = v3d_get_extensions(file_priv, args->extensions, &se); ret = v3d_get_extensions(file_priv, args->extensions, &se, NULL);
if (ret) { if (ret) {
DRM_DEBUG("Failed to get extensions.\n"); DRM_DEBUG("Failed to get extensions.\n");
return ret; return ret;
...@@ -805,7 +806,7 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data, ...@@ -805,7 +806,7 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data,
return ret; return ret;
if (args->flags & DRM_V3D_SUBMIT_EXTENSION) { if (args->flags & DRM_V3D_SUBMIT_EXTENSION) {
ret = v3d_get_extensions(file_priv, args->extensions, &se); ret = v3d_get_extensions(file_priv, args->extensions, &se, cpu_job);
if (ret) { if (ret) {
DRM_DEBUG("Failed to get extensions.\n"); DRM_DEBUG("Failed to get extensions.\n");
goto fail; goto fail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment