[PATCH 4/6] drm/amd/amdgpu: Pin bos from imported dma-bufs to GTT.

Michel Dänzer michel at daenzer.net
Wed Mar 29 09:07:59 UTC 2017

On 29/03/17 04:14 PM, Christian König wrote:
> Am 29.03.2017 um 02:27 schrieb raof at ubuntu.com:
>> From: Christopher James Halse Rogers
>> <christopher.halse.rogers at canonical.com>
>> Attempting to migrate the bo will break the sharing of the buffer.
>> Signed-off-by: Christopher James Halse Rogers
>> <christopher.halse.rogers at canonical.com>
>> CC: amd-gfx at lists.freedesktop.org
> NAK on this one and the radeon version.
> We can't migrate the buffers to VRAM, but we shouldn't pin it either
> cause that will lock down the GTT space used for it.

Ah, good point, didn't think of that.

> Instead you should modify amdgpu_bo_pin() and fail if anybody tries to
> migrate a BO which has prime_shared_count != 0 to VRAM (you migth need
> to add this for radeon).

This would also need to be checked in the AMDGPU_GEM_OP_SET_PLACEMENT
case of amdgpu_gem_op_ioctl, otherwise userspace can change
prefered_domains to AMDGPU_GEM_DOMAIN_VRAM, and using the BO for GPU
operations may move it to VRAM.

Or maybe there's a central place which can catch both of these cases
(and any others).

Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer

More information about the amd-gfx mailing list