Skip to content

Commit 0a1db6f

Browse files
matt-auldrodrigovivi
authored andcommitted
drm/i915/gem: Allow backends to override pread implementation
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>
1 parent f8394f2 commit 0a1db6f

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/gpu/drm/i915/gem/i915_gem_object_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ struct drm_i915_gem_object_ops {
5656
void (*truncate)(struct drm_i915_gem_object *obj);
5757
void (*writeback)(struct drm_i915_gem_object *obj);
5858

59+
int (*pread)(struct drm_i915_gem_object *obj,
60+
const struct drm_i915_gem_pread *arg);
5961
int (*pwrite)(struct drm_i915_gem_object *obj,
6062
const struct drm_i915_gem_pwrite *arg);
6163

drivers/gpu/drm/i915/i915_gem.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,12 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data,
527527

528528
trace_i915_gem_object_pread(obj, args->offset, args->size);
529529

530+
ret = -ENODEV;
531+
if (obj->ops->pread)
532+
ret = obj->ops->pread(obj, args);
533+
if (ret != -ENODEV)
534+
goto out;
535+
530536
ret = i915_gem_object_wait(obj,
531537
I915_WAIT_INTERRUPTIBLE,
532538
MAX_SCHEDULE_TIMEOUT);

0 commit comments

Comments
 (0)