drm/v3d: alloc and init job in one shot
authorMelissa Wen <mwen@igalia.com>
Thu, 30 Sep 2021 16:17:39 +0000 (17:17 +0100)
committerMelissa Wen <melissa.srw@gmail.com>
Mon, 4 Oct 2021 09:08:16 +0000 (10:08 +0100)
commit07c2a41658c454c8f148c7fd6b0cbcecb78e9829
treebab79bc1ecf8aa332b58228871cfcb2d0f5cc07c
parent223583dd00a70ae57031c6004948ea177a4745b5
drm/v3d: alloc and init job in one shot

Move job memory allocation to v3d_job_init function. This aim to facilitate
error handling in job initialization, since cleanup steps are similar for
all (struct v3d_job)-based types of job involved in a command submission.
To generalize v3d_job_init(), this change takes into account that all job
structs have the first element a struct v3d_job (bin, render, tfu, csd) or
it is a v3d_job itself (clean_job) for pointer casting.

v3:
- explicitly init job as NULL (Iago)
- fix pm failure handling on v3_job_init (Iago)

Suggested-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4d12e07bd334d2cddb51cabd359e99edde595619.1633016479.git.mwen@igalia.com
drivers/gpu/drm/v3d/v3d_gem.c