@@ -1363,43 +1363,50 @@ struct drm_i915_gem_busy {
13631363};
13641364
13651365/**
1366- * I915_CACHING_NONE
1366+ * struct drm_i915_gem_caching - Set or get the caching for given object
1367+ * handle.
13671368 *
1368- * GPU access is not coherent with cpu caches. Default for machines without an
1369- * LLC.
1369+ * Allow userspace to control the GTT caching bits for a given object when the
1370+ * object is later mapped through the ppGTT(or GGTT on older platforms lacking
1371+ * ppGTT support, or if the object is used for scanout). Note that this might
1372+ * require unbinding the object from the GTT first, if its current caching value
1373+ * doesn't match.
13701374 */
1371- #define I915_CACHING_NONE 0
1372- /**
1373- * I915_CACHING_CACHED
1374- *
1375- * GPU access is coherent with cpu caches and furthermore the data is cached in
1376- * last-level caches shared between cpu cores and the gpu GT. Default on
1377- * machines with HAS_LLC.
1378- */
1379- #define I915_CACHING_CACHED 1
1380- /**
1381- * I915_CACHING_DISPLAY
1382- *
1383- * Special GPU caching mode which is coherent with the scanout engines.
1384- * Transparently falls back to I915_CACHING_NONE on platforms where no special
1385- * cache mode (like write-through or gfdt flushing) is available. The kernel
1386- * automatically sets this mode when using a buffer as a scanout target.
1387- * Userspace can manually set this mode to avoid a costly stall and clflush in
1388- * the hotpath of drawing the first frame.
1389- */
1390- #define I915_CACHING_DISPLAY 2
1391-
13921375struct drm_i915_gem_caching {
13931376 /**
1394- * Handle of the buffer to set/get the caching level of. */
1377+ * @handle: Handle of the buffer to set/get the caching level.
1378+ */
13951379 __u32 handle ;
13961380
13971381 /**
1398- * Cacheing level to apply or return value
1382+ * @caching: The GTT caching level to apply or possible return value.
13991383 *
1400- * bits0-15 are for generic caching control (i.e. the above defined
1401- * values). bits16-31 are reserved for platform-specific variations
1402- * (e.g. l3$ caching on gen7). */
1384+ * The supported @caching values:
1385+ *
1386+ * I915_CACHING_NONE:
1387+ *
1388+ * GPU access is not coherent with CPU caches. Default for machines
1389+ * without an LLC. This means manual flushing might be needed, if we
1390+ * want GPU access to be coherent.
1391+ *
1392+ * I915_CACHING_CACHED:
1393+ *
1394+ * GPU access is coherent with CPU caches and furthermore the data is
1395+ * cached in last-level caches shared between CPU cores and the GPU GT.
1396+ *
1397+ * I915_CACHING_DISPLAY:
1398+ *
1399+ * Special GPU caching mode which is coherent with the scanout engines.
1400+ * Transparently falls back to I915_CACHING_NONE on platforms where no
1401+ * special cache mode (like write-through or gfdt flushing) is
1402+ * available. The kernel automatically sets this mode when using a
1403+ * buffer as a scanout target. Userspace can manually set this mode to
1404+ * avoid a costly stall and clflush in the hotpath of drawing the first
1405+ * frame.
1406+ */
1407+ #define I915_CACHING_NONE 0
1408+ #define I915_CACHING_CACHED 1
1409+ #define I915_CACHING_DISPLAY 2
14031410 __u32 caching ;
14041411};
14051412
0 commit comments