return 0;
}
+/* Returns false if the CPU job has an invalid configuration. */
+static bool
+v3d_validate_cpu_job(struct drm_file *file_priv, struct v3d_cpu_job *job)
+{
+ struct v3d_file_priv *v3d_priv = file_priv->driver_priv;
+ struct v3d_dev *v3d = v3d_priv->v3d;
+
+ if (!job) {
+ drm_dbg(&v3d->drm, "CPU job extension was attached to a GPU job.\n");
+ return false;
+ }
+
+ if (job->job_type) {
+ drm_dbg(&v3d->drm, "Two CPU job extensions were added to the same CPU job.\n");
+ return false;
+ }
+
+ return true;
+}
+
/* Get data for the indirect CSD job submission. */
static int
v3d_get_cpu_indirect_csd_params(struct drm_file *file_priv,
struct drm_v3d_indirect_csd indirect_csd;
struct v3d_indirect_csd_info *info = &job->indirect_csd;
- if (!job) {
- DRM_DEBUG("CPU job extension was attached to a GPU job.\n");
- return -EINVAL;
- }
-
- if (job->job_type) {
- DRM_DEBUG("Two CPU job extensions were added to the same CPU job.\n");
+ if (!v3d_validate_cpu_job(file_priv, job))
return -EINVAL;
- }
if (copy_from_user(&indirect_csd, ext, sizeof(indirect_csd)))
return -EFAULT;
unsigned int i;
int err;
- if (!job) {
- DRM_DEBUG("CPU job extension was attached to a GPU job.\n");
- return -EINVAL;
- }
-
- if (job->job_type) {
- DRM_DEBUG("Two CPU job extensions were added to the same CPU job.\n");
+ if (!v3d_validate_cpu_job(file_priv, job))
return -EINVAL;
- }
if (copy_from_user(×tamp, ext, sizeof(timestamp)))
return -EFAULT;
unsigned int i;
int err;
- if (!job) {
- DRM_DEBUG("CPU job extension was attached to a GPU job.\n");
- return -EINVAL;
- }
-
- if (job->job_type) {
- DRM_DEBUG("Two CPU job extensions were added to the same CPU job.\n");
+ if (!v3d_validate_cpu_job(file_priv, job))
return -EINVAL;
- }
if (copy_from_user(&reset, ext, sizeof(reset)))
return -EFAULT;
unsigned int i;
int err;
- if (!job) {
- DRM_DEBUG("CPU job extension was attached to a GPU job.\n");
- return -EINVAL;
- }
-
- if (job->job_type) {
- DRM_DEBUG("Two CPU job extensions were added to the same CPU job.\n");
+ if (!v3d_validate_cpu_job(file_priv, job))
return -EINVAL;
- }
if (copy_from_user(©, ext, sizeof(copy)))
return -EFAULT;
struct drm_v3d_reset_performance_query reset;
int err;
- if (!job) {
- DRM_DEBUG("CPU job extension was attached to a GPU job.\n");
- return -EINVAL;
- }
-
- if (job->job_type) {
- DRM_DEBUG("Two CPU job extensions were added to the same CPU job.\n");
+ if (!v3d_validate_cpu_job(file_priv, job))
return -EINVAL;
- }
if (copy_from_user(&reset, ext, sizeof(reset)))
return -EFAULT;
struct drm_v3d_copy_performance_query copy;
int err;
- if (!job) {
- DRM_DEBUG("CPU job extension was attached to a GPU job.\n");
- return -EINVAL;
- }
-
- if (job->job_type) {
- DRM_DEBUG("Two CPU job extensions were added to the same CPU job.\n");
+ if (!v3d_validate_cpu_job(file_priv, job))
return -EINVAL;
- }
if (copy_from_user(©, ext, sizeof(copy)))
return -EFAULT;