[Intel-gfx] [PATCH v3 5/5] drm/i915/gem: Migrate to system at dma-buf map time
Thomas Hellström
thomas.hellstrom at linux.intel.com
Mon Jun 28 19:51:42 UTC 2021
On 6/28/21 9:45 PM, Ruhl, Michael J wrote:
>> -----Original Message-----
>> From: dri-devel <dri-devel-bounces at lists.freedesktop.org> On Behalf Of
>> Thomas Hellström
>> Sent: Monday, June 28, 2021 10:46 AM
>> To: intel-gfx at lists.freedesktop.org; dri-devel at lists.freedesktop.org
>> Cc: Thomas Hellström <thomas.hellstrom at linux.intel.com>; Auld, Matthew
>> <matthew.auld at intel.com>
>> Subject: [PATCH v3 5/5] drm/i915/gem: Migrate to system at dma-buf map
>> time
>>
>> Until we support p2p dma or as a complement to that, migrate data
>> to system memory at dma-buf map time if possible.
>>
>> v2:
>> - Rebase on dynamic exporter. Update the igt_dmabuf_import_same_driver
>> selftest to migrate if we are LMEM capable.
>>
>> Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
>> ---
>> drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c | 7 ++++++-
>> drivers/gpu/drm/i915/gem/selftests/i915_gem_dmabuf.c | 4 +++-
>> 2 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
>> b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
>> index 1d1eeb167d28..5207aa3af009 100644
>> --- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c
>> @@ -29,7 +29,12 @@ static struct sg_table *i915_gem_map_dma_buf(struct
>> dma_buf_attachment *attachme
>>
>> assert_object_held(obj);
>>
>> - ret = i915_gem_object_pin_pages(obj);
>> + if (!i915_gem_object_can_migrate(obj, INTEL_REGION_SMEM))
>> + return ERR_PTR(-EOPNOTSUPP);
>> +
>> + ret = i915_gem_object_migrate(obj, NULL, INTEL_REGION_SMEM);
>> + if (!ret)
>> + ret = i915_gem_object_pin_pages(obj);
>> if (ret)
>> goto err;
> With the caveats of the previous patches this looks good.
Yes, this sort of sucks, but knowing that we have a correct
implementation in the works...
>
> Reviewed-by: Michael J. Ruhl <michael.j.ruhl at intel.com>
>
> Mike
Thanks for the reviews!
Thomas
More information about the Intel-gfx
mailing list