[09/12] drm/amdgpu: disallow foreign BOs in the display path

Submitted by Kuehling, Felix on July 3, 2017, 9:11 p.m.

Details

Message ID 1499116294-12817-10-git-send-email-Felix.Kuehling@amd.com
State New
Headers show
Series "Patches from amd-kfd-staging" ( rev: 4 3 2 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Kuehling, Felix July 3, 2017, 9:11 p.m.
From: Christian König <christian.koenig@amd.com>

Pinning them in other devices VRAM would obviously not work.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 ++++++
 1 file changed, 6 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 3341c34..bd6b0dc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -180,6 +180,12 @@  int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,
 	obj = new_amdgpu_fb->obj;
 	new_abo = gem_to_amdgpu_bo(obj);
 
+	if (amdgpu_ttm_adev(new_abo->tbo.bdev) != adev) {
+		DRM_ERROR("Foreign BOs not allowed in the display engine\n");
+		r = -EINVAL;
+		goto cleanup;
+	}
+
 	/* pin the new buffer */
 	r = amdgpu_bo_reserve(new_abo, false);
 	if (unlikely(r != 0)) {

Comments

On Mon, Jul 3, 2017 at 5:11 PM, Felix Kuehling <Felix.Kuehling@amd.com> wrote:
> From: Christian König <christian.koenig@amd.com>
>
> Pinning them in other devices VRAM would obviously not work.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>

Do we need to check in the DC (amdgpu_dm_types.c) and the dce
(dce_v*_0.c) code as well?

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> index 3341c34..bd6b0dc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
> @@ -180,6 +180,12 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,
>         obj = new_amdgpu_fb->obj;
>         new_abo = gem_to_amdgpu_bo(obj);
>
> +       if (amdgpu_ttm_adev(new_abo->tbo.bdev) != adev) {
> +               DRM_ERROR("Foreign BOs not allowed in the display engine\n");
> +               r = -EINVAL;
> +               goto cleanup;
> +       }
> +
>         /* pin the new buffer */
>         r = amdgpu_bo_reserve(new_abo, false);
>         if (unlikely(r != 0)) {
> --
> 1.9.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
On 17-07-06 05:13 PM, Alex Deucher wrote:
> On Mon, Jul 3, 2017 at 5:11 PM, Felix Kuehling <Felix.Kuehling@amd.com> wrote:
>> From: Christian König <christian.koenig@amd.com>
>>
>> Pinning them in other devices VRAM would obviously not work.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
> Do we need to check in the DC (amdgpu_dm_types.c) and the dce
> (dce_v*_0.c) code as well?

Probably. I have it as a TODO on my separate P2P patch series.

Regards,
  Felix

>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> index 3341c34..bd6b0dc 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
>> @@ -180,6 +180,12 @@ int amdgpu_crtc_page_flip_target(struct drm_crtc *crtc,
>>         obj = new_amdgpu_fb->obj;
>>         new_abo = gem_to_amdgpu_bo(obj);
>>
>> +       if (amdgpu_ttm_adev(new_abo->tbo.bdev) != adev) {
>> +               DRM_ERROR("Foreign BOs not allowed in the display engine\n");
>> +               r = -EINVAL;
>> +               goto cleanup;
>> +       }
>> +
>>         /* pin the new buffer */
>>         r = amdgpu_bo_reserve(new_abo, false);
>>         if (unlikely(r != 0)) {
>> --
>> 1.9.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx