All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] drm/amdgpu: Remove VRAM from shared bo domains.
@ 2018-04-18 21:51 Samuel Li
       [not found] ` <1524088264-9284-1-git-send-email-Samuel.Li-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Li @ 2018-04-18 21:51 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Samuel Li

Signed-off-by: Samuel Li <Samuel.Li@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 24f582c..8dc782a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -689,8 +689,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 		return -EINVAL;
 
 	/* A shared bo cannot be migrated to VRAM */
-	if (bo->prime_shared_count && (domain == AMDGPU_GEM_DOMAIN_VRAM))
-		return -EINVAL;
+	if (bo->prime_shared_count) {
+		if (domain & AMDGPU_GEM_DOMAIN_GTT)
+			domain = AMDGPU_GEM_DOMAIN_GTT;
+		else
+			return -EINVAL;
+	}
 
 	if (bo->pin_count) {
 		uint32_t mem_type = bo->tbo.mem.mem_type;
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/3] drm/amdgpu: Remove VRAM from shared bo domains.
       [not found] ` <1524088264-9284-1-git-send-email-Samuel.Li-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-18 22:09   ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2018-04-18 22:09 UTC (permalink / raw)
  To: Samuel Li; +Cc: amd-gfx list

On Wed, Apr 18, 2018 at 5:51 PM, Samuel Li <Samuel.Li@amd.com> wrote:
> Signed-off-by: Samuel Li <Samuel.Li@amd.com>

Please add a commit message.  E.g.,

This fixes a potential regression introduced when SG display support
was initially added which could lead to a shared
buffer ending up pinned in vram.  Check if GTT is allowed in the
domain and use that if so, otherwise return an error.

With that fixed:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 24f582c..8dc782a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -689,8 +689,12 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>                 return -EINVAL;
>
>         /* A shared bo cannot be migrated to VRAM */
> -       if (bo->prime_shared_count && (domain == AMDGPU_GEM_DOMAIN_VRAM))
> -               return -EINVAL;
> +       if (bo->prime_shared_count) {
> +               if (domain & AMDGPU_GEM_DOMAIN_GTT)
> +                       domain = AMDGPU_GEM_DOMAIN_GTT;
> +               else
> +                       return -EINVAL;
> +       }
>
>         if (bo->pin_count) {
>                 uint32_t mem_type = bo->tbo.mem.mem_type;
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-18 22:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 21:51 [PATCH 2/3] drm/amdgpu: Remove VRAM from shared bo domains Samuel Li
     [not found] ` <1524088264-9284-1-git-send-email-Samuel.Li-5C7GfCeVMHo@public.gmane.org>
2018-04-18 22:09   ` 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.