]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/gem: Allow backends to override pread implementation
authorMatthew Auld <matthew.auld@intel.com>
Thu, 5 Nov 2020 15:49:33 +0000 (15:49 +0000)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Fri, 13 Nov 2020 00:47:30 +0000 (19:47 -0500)
As there are more and more complicated interactions between the different
backing stores and userspace, push the control into the backends rather
than accumulate them all inside the ioctl handlers.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20201105154934.16022-1-chris@chris-wilson.co.uk
(cherry picked from commit 0049b688459b846f819b6e51c24cd0781fcfde41)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/gem/i915_gem_object_types.h
drivers/gpu/drm/i915/i915_gem.c

index b5c15557cc87b8eaced85355b8e1eb5d4abfcabd..d6711caa7f399564120d7eb9dca039bcf3183bd0 100644 (file)
@@ -56,6 +56,8 @@ struct drm_i915_gem_object_ops {
        void (*truncate)(struct drm_i915_gem_object *obj);
        void (*writeback)(struct drm_i915_gem_object *obj);
 
+       int (*pread)(struct drm_i915_gem_object *obj,
+                    const struct drm_i915_gem_pread *arg);
        int (*pwrite)(struct drm_i915_gem_object *obj,
                      const struct drm_i915_gem_pwrite *arg);
 
index bb0c12975f38e577309d099544edbd097a7405f7..d58fe1ddc3e153a780726266e5f9aa0e19844fed 100644 (file)
@@ -527,6 +527,12 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
 
        trace_i915_gem_object_pread(obj, args->offset, args->size);
 
+       ret = -ENODEV;
+       if (obj->ops->pread)
+               ret = obj->ops->pread(obj, args);
+       if (ret != -ENODEV)
+               goto out;
+
        ret = i915_gem_object_wait(obj,
                                   I915_WAIT_INTERRUPTIBLE,
                                   MAX_SCHEDULE_TIMEOUT);