• Ankitprasad Sharma's avatar
    drm/i915: Support for pread/pwrite from/to non shmem backed objects · b50a5371
    Ankitprasad Sharma authored
    This patch adds support for extending the pread/pwrite functionality
    for objects not backed by shmem. The access will be made through
    gtt interface. This will cover objects backed by stolen memory as well
    as other non-shmem backed objects.
    
    v2: Drop locks around slow_user_access, prefault the pages before
    access (Chris)
    
    v3: Rebased to the latest drm-intel-nightly (Ankit)
    
    v4: Moved page base & offset calculations outside the copy loop,
    corrected data types for size and offset variables, corrected if-else
    braces format (Tvrtko/kerneldocs)
    
    v5: Enabled pread/pwrite for all non-shmem backed objects including
    without tiling restrictions (Ankit)
    
    v6: Using pwrite_fast for non-shmem backed objects as well (Chris)
    
    v7: Updated commit message, Renamed i915_gem_gtt_read to i915_gem_gtt_copy,
    added pwrite slow path for non-shmem backed objects (Chris/Tvrtko)
    
    v8: Updated v7 commit message, mutex unlock around pwrite slow path for
    non-shmem backed objects (Tvrtko)
    
    v9: Corrected check during pread_ioctl, to avoid shmem_pread being
    called for non-shmem backed objects (Tvrtko)
    
    v10: Moved the write_domain check to needs_clflush and tiling mode check
    to pwrite_fast (Chris)
    
    v11: Use pwrite_fast fallback for all objects (shmem and non-shmem backed),
    call fast_user_write regardless of pagefault in previous iteration
    
    v12: Use page-by-page copy for slow user access too (Chris)
    
    v13: Handled EFAULT, Avoid use of WARN_ON, put_fence only if whole obj
    pinned (Chris)
    
    v14: Corrected datatypes/initializations (Tvrtko)
    
    Testcase: igt/gem_stolen, igt/gem_pread, igt/gem_pwrite
    Signed-off-by: default avatarAnkitprasad Sharma <ankitprasad.r.sharma@intel.com>
    Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/1465548783-19712-1-git-send-email-ankitprasad.r.sharma@intel.com
    b50a5371
i915_gem.c 143 KB