/* * SPDX-License-Identifier: MIT * * Copyright © 2014-2016 Intel Corporation */ #include "display/intel_display.h" #include "gt/intel_gt.h" #include "i915_drv.h" #include "i915_gem_clflush.h" #include "i915_gem_domain.h" #include "i915_gem_gtt.h" #include "i915_gem_ioctls.h" #include "i915_gem_lmem.h" #include "i915_gem_mman.h" #include "i915_gem_object.h" #include "i915_gem_object_frontbuffer.h" #include "i915_vma.h" #define VTD_GUARD … static bool gpu_write_needs_clflush(struct drm_i915_gem_object *obj) { … } bool i915_gem_cpu_write_needs_clflush(struct drm_i915_gem_object *obj) { … } static void flush_write_domain(struct drm_i915_gem_object *obj, unsigned int flush_domains) { … } static void __i915_gem_object_flush_for_display(struct drm_i915_gem_object *obj) { … } void i915_gem_object_flush_if_display(struct drm_i915_gem_object *obj) { … } void i915_gem_object_flush_if_display_locked(struct drm_i915_gem_object *obj) { … } /** * i915_gem_object_set_to_wc_domain - Moves a single object to the WC read, and * possibly write domain. * @obj: object to act on * @write: ask for write access or read only * * This function returns when the move is complete, including waiting on * flushes to occur. */ int i915_gem_object_set_to_wc_domain(struct drm_i915_gem_object *obj, bool write) { … } /** * i915_gem_object_set_to_gtt_domain - Moves a single object to the GTT read, * and possibly write domain. * @obj: object to act on * @write: ask for write access or read only * * This function returns when the move is complete, including waiting on * flushes to occur. */ int i915_gem_object_set_to_gtt_domain(struct drm_i915_gem_object *obj, bool write) { … } /** * i915_gem_object_set_cache_level - Changes the cache-level of an object across all VMA. * @obj: object to act on * @cache_level: new cache level to set for the object * * After this function returns, the object will be in the new cache-level * across all GTT and the contents of the backing storage will be coherent, * with respect to the new cache-level. In order to keep the backing storage * coherent for all users, we only allow a single cache level to be set * globally on the object and prevent it from being changed whilst the * hardware is reading from the object. That is if the object is currently * on the scanout it will be set to uncached (or equivalent display * cache coherency) and all non-MOCS GPU access will also be uncached so * that all direct access to the scanout remains coherent. */ int i915_gem_object_set_cache_level(struct drm_i915_gem_object *obj, enum i915_cache_level cache_level) { … } int i915_gem_get_caching_ioctl(struct drm_device *dev, void *data, struct drm_file *file) { … } int i915_gem_set_caching_ioctl(struct drm_device *dev, void *data, struct drm_file *file) { … } /* * Prepare buffer for display plane (scanout, cursors, etc). Can be called from * an uninterruptible phase (modesetting) and allows any flushes to be pipelined * (for pageflips). We only flush the caches while preparing the buffer for * display, the callers are responsible for frontbuffer flush. */ struct i915_vma * i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj, struct i915_gem_ww_ctx *ww, u32 alignment, const struct i915_gtt_view *view, unsigned int flags) { … } /** * i915_gem_object_set_to_cpu_domain - Moves a single object to the CPU read, * and possibly write domain. * @obj: object to act on * @write: requesting write or read-only access * * This function returns when the move is complete, including waiting on * flushes to occur. */ int i915_gem_object_set_to_cpu_domain(struct drm_i915_gem_object *obj, bool write) { … } /** * i915_gem_set_domain_ioctl - Called when user space prepares to use an * object with the CPU, either * through the mmap ioctl's mapping or a GTT mapping. * @dev: drm device * @data: ioctl data blob * @file: drm file */ int i915_gem_set_domain_ioctl(struct drm_device *dev, void *data, struct drm_file *file) { … } /* * Pins the specified object's pages and synchronizes the object with * GPU accesses. Sets needs_clflush to non-zero if the caller should * flush the object from the CPU cache. */ int i915_gem_object_prepare_read(struct drm_i915_gem_object *obj, unsigned int *needs_clflush) { … } int i915_gem_object_prepare_write(struct drm_i915_gem_object *obj, unsigned int *needs_clflush) { … }