History

drm/v3d: clean caches at the end of render jobs on request from user space

Extends the user space ioctl for CL submissions so it can include a request to flush the cache once the CL execution has completed. Fixes memory write violation messages reported by the kernel in workloads involving shader memory writes (SSBOs, shader images, scratch, etc) which sometimes also lead to GPU resets during Piglit and CTS workloads. v2: if v3d_job_init() fails we need to kfree() the job instead of v3d_job_put() it (Eric Anholt). v3 (Eric Anholt): - Drop _FLAG suffix from the new flag name. - Add a new param so userspace can tell whether cache flushing is implemented in the kernel.

Iago Toral Quiroga committed 7 years ago

Commit 455d56c1 parent 978f6b03 files · +54 −11Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/drm/v3d_drm.h+5−3
@@ -48,6 +48,8 @@ extern "C" { · 47 unmodified lines
48#define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)48#define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)
49#define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)49#define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)
50 50
51#define DRM_V3D_SUBMIT_CL_FLUSH_CACHE 0x01
52
51/**53/**
52 * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D54 * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D
53 * engine.55 * engine.
@@ -61,7 +63,7 @@ extern "C" { · 7 unmodified lines
61 * flushed by the time the render done IRQ happens, which is the63 * flushed by the time the render done IRQ happens, which is the
62 * trigger for out_sync. Any dirtying of cachelines by the job (only64 * trigger for out_sync. Any dirtying of cachelines by the job (only
63 * possible using TMU writes) must be flushed by the caller using the65 * possible using TMU writes) must be flushed by the caller using the
64 * CL's cache flush commands.66 * DRM_V3D_SUBMIT_CL_FLUSH_CACHE_FLAG flag.
65 */67 */
66struct drm_v3d_submit_cl {68struct drm_v3d_submit_cl {
67 /* Pointer to the binner command list.69 /* Pointer to the binner command list.
@@ -124,8 +126,7 @@ struct drm_v3d_submit_cl { · 56 unmodified lines
124 /* Number of BO handles passed in (size is that times 4). */126 /* Number of BO handles passed in (size is that times 4). */
125 __u32 bo_handle_count;127 __u32 bo_handle_count;
126 128
127 /* Pad, must be zero-filled. */129 __u32 flags;
128 __u32 pad;
129};130};
130 131
131/**132/**
@@ -193,6 +194,7 @@ enum drm_v3d_param { · 61 unmodified lines
193 DRM_V3D_PARAM_V3D_CORE0_IDENT2,194 DRM_V3D_PARAM_V3D_CORE0_IDENT2,
194 DRM_V3D_PARAM_SUPPORTS_TFU,195 DRM_V3D_PARAM_SUPPORTS_TFU,
195 DRM_V3D_PARAM_SUPPORTS_CSD,196 DRM_V3D_PARAM_SUPPORTS_CSD,
197 DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH,
196};198};
197 199
198struct drm_v3d_get_param {200struct drm_v3d_get_param {