* [PATCH] drm/amdgpu: use the preferred pin domain after the check
@ 2021-08-20 8:30 Christian König
2021-08-20 8:55 ` Sharma, Shashank
2021-08-20 13:13 ` Alex Deucher
0 siblings, 2 replies; 3+ messages in thread
From: Christian König @ 2021-08-20 8:30 UTC (permalink / raw)
To: amd-gfx; +Cc: Alexander.Deucher
For some reason we run into an use case where a BO is already pinned
into GTT, but should be pinned into VRAM|GTT again.
Handle that case gracefully as well.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 795fa7445abe..92c8e6e7f346 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -920,11 +920,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
return -EINVAL;
}
- /* This assumes only APU display buffers are pinned with (VRAM|GTT).
- * See function amdgpu_display_supported_domains()
- */
- domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
-
if (bo->tbo.pin_count) {
uint32_t mem_type = bo->tbo.resource->mem_type;
uint32_t mem_flags = bo->tbo.resource->placement;
@@ -949,6 +944,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
return 0;
}
+ /* This assumes only APU display buffers are pinned with (VRAM|GTT).
+ * See function amdgpu_display_supported_domains()
+ */
+ domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
+
if (bo->tbo.base.import_attach)
dma_buf_pin(bo->tbo.base.import_attach);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] drm/amdgpu: use the preferred pin domain after the check
2021-08-20 8:30 [PATCH] drm/amdgpu: use the preferred pin domain after the check Christian König
@ 2021-08-20 8:55 ` Sharma, Shashank
2021-08-20 13:13 ` Alex Deucher
1 sibling, 0 replies; 3+ messages in thread
From: Sharma, Shashank @ 2021-08-20 8:55 UTC (permalink / raw)
To: Christian König, amd-gfx; +Cc: Deucher, Alexander
[AMD Official Use Only]
Please feel free to use:
Reviewed-by: Shashank Sharma <Shashank.sharma@amd.com>
Regards
Shashank
-----Original Message-----
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Christian König
Sent: Friday, August 20, 2021 2:01 PM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
Subject: [PATCH] drm/amdgpu: use the preferred pin domain after the check
For some reason we run into an use case where a BO is already pinned into GTT, but should be pinned into VRAM|GTT again.
Handle that case gracefully as well.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 795fa7445abe..92c8e6e7f346 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -920,11 +920,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
return -EINVAL;
}
- /* This assumes only APU display buffers are pinned with (VRAM|GTT).
- * See function amdgpu_display_supported_domains()
- */
- domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
-
if (bo->tbo.pin_count) {
uint32_t mem_type = bo->tbo.resource->mem_type;
uint32_t mem_flags = bo->tbo.resource->placement; @@ -949,6 +944,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
return 0;
}
+ /* This assumes only APU display buffers are pinned with (VRAM|GTT).
+ * See function amdgpu_display_supported_domains()
+ */
+ domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
+
if (bo->tbo.base.import_attach)
dma_buf_pin(bo->tbo.base.import_attach);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: use the preferred pin domain after the check
2021-08-20 8:30 [PATCH] drm/amdgpu: use the preferred pin domain after the check Christian König
2021-08-20 8:55 ` Sharma, Shashank
@ 2021-08-20 13:13 ` Alex Deucher
1 sibling, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2021-08-20 13:13 UTC (permalink / raw)
To: Christian König; +Cc: amd-gfx list, Deucher, Alexander
On Fri, Aug 20, 2021 at 4:30 AM Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
>
> For some reason we run into an use case where a BO is already pinned
> into GTT, but should be pinned into VRAM|GTT again.
>
> Handle that case gracefully as well.
>
> Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 795fa7445abe..92c8e6e7f346 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -920,11 +920,6 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
> return -EINVAL;
> }
>
> - /* This assumes only APU display buffers are pinned with (VRAM|GTT).
> - * See function amdgpu_display_supported_domains()
> - */
> - domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
> -
> if (bo->tbo.pin_count) {
> uint32_t mem_type = bo->tbo.resource->mem_type;
> uint32_t mem_flags = bo->tbo.resource->placement;
> @@ -949,6 +944,11 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
> return 0;
> }
>
> + /* This assumes only APU display buffers are pinned with (VRAM|GTT).
> + * See function amdgpu_display_supported_domains()
> + */
> + domain = amdgpu_bo_get_preferred_pin_domain(adev, domain);
> +
> if (bo->tbo.base.import_attach)
> dma_buf_pin(bo->tbo.base.import_attach);
>
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-20 13:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 8:30 [PATCH] drm/amdgpu: use the preferred pin domain after the check Christian König
2021-08-20 8:55 ` Sharma, Shashank
2021-08-20 13:13 ` Alex Deucher
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.