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
4848 #define DRM_IOCTL_V3D_SUBMIT_TFU DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_TFU, struct drm_v3d_submit_tfu)
4949 #define DRM_IOCTL_V3D_SUBMIT_CSD DRM_IOW(DRM_COMMAND_BASE + DRM_V3D_SUBMIT_CSD, struct drm_v3d_submit_csd)
5050
51+#define DRM_V3D_SUBMIT_CL_FLUSH_CACHE 0x01
52+
5153 /**
5254 * struct drm_v3d_submit_cl - ioctl argument for submitting commands to the 3D
5355 * engine.
@@ -61,7 +63,7 @@ extern "C" { · 7 unmodified lines
6163 * flushed by the time the render done IRQ happens, which is the
6264 * trigger for out_sync. Any dirtying of cachelines by the job (only
6365 * 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.
6567 */
6668 struct drm_v3d_submit_cl {
6769 /* Pointer to the binner command list.
@@ -124,8 +126,7 @@ struct drm_v3d_submit_cl { · 56 unmodified lines
124126 /* Number of BO handles passed in (size is that times 4). */
125127 __u32 bo_handle_count;
126128
127− /* Pad, must be zero-filled. */
128− __u32 pad;
129+ __u32 flags;
129130 };
130131
131132 /**
@@ -193,6 +194,7 @@ enum drm_v3d_param { · 61 unmodified lines
193194 DRM_V3D_PARAM_V3D_CORE0_IDENT2,
194195 DRM_V3D_PARAM_SUPPORTS_TFU,
195196 DRM_V3D_PARAM_SUPPORTS_CSD,
197+ DRM_V3D_PARAM_SUPPORTS_CACHE_FLUSH,
196198 };
197199
198200 struct drm_v3d_get_param {