All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: consider user preference when pinning for SG display
@ 2018-05-17 16:55 Alex Deucher
       [not found] ` <20180517165521.8581-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Alex Deucher @ 2018-05-17 16:55 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

If the pin domain is set to GTT | VRAM, look at the preferred domains
for the bo and respect that if it's been set explicitly.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 6a9e46ae7f0a..16192f17653e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
 	 * See function amdgpu_display_supported_domains()
 	 */
 	if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
-		domain = AMDGPU_GEM_DOMAIN_VRAM;
-		if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
+		if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
+			domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user really wants vram, respect it */
+		else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
+			domain = AMDGPU_GEM_DOMAIN_GTT; /* if user really wants gtt, respect it */
+		else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
 			domain = AMDGPU_GEM_DOMAIN_GTT;
+		else
+			domain = AMDGPU_GEM_DOMAIN_VRAM;
 	}
 
 	if (bo->pin_count) {
-- 
2.13.6

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

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found] ` <20180517165521.8581-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
@ 2018-05-18  8:21   ` Michel Dänzer
       [not found]     ` <4dc6cde7-fb5c-81c2-6678-8e90e1beb78e-otUistvHUpPR7s880joybQ@public.gmane.org>
  2018-05-18  9:56   ` Christian König
  1 sibling, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2018-05-18  8:21 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

On 2018-05-17 06:55 PM, Alex Deucher wrote:
> If the pin domain is set to GTT | VRAM, look at the preferred domains
> for the bo and respect that if it's been set explicitly.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 6a9e46ae7f0a..16192f17653e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>  	 * See function amdgpu_display_supported_domains()
>  	 */
>  	if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
> -		domain = AMDGPU_GEM_DOMAIN_VRAM;
> -		if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
> +		if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
> +			domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user really wants vram, respect it */
> +		else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
> +			domain = AMDGPU_GEM_DOMAIN_GTT; /* if user really wants gtt, respect it */

I'd spell VRAM and GTT in capital letters in the comments.


> +		else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>  			domain = AMDGPU_GEM_DOMAIN_GTT;
> +		else
> +			domain = AMDGPU_GEM_DOMAIN_VRAM;
>  	}

Is everything in place to deal with any issues that might occur when
flipping between buffers in VRAM and GTT?


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found] ` <20180517165521.8581-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
  2018-05-18  8:21   ` Michel Dänzer
@ 2018-05-18  9:56   ` Christian König
  1 sibling, 0 replies; 12+ messages in thread
From: Christian König @ 2018-05-18  9:56 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Alex Deucher

Am 17.05.2018 um 18:55 schrieb Alex Deucher:
> If the pin domain is set to GTT | VRAM, look at the preferred domains
> for the bo and respect that if it's been set explicitly.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 6a9e46ae7f0a..16192f17653e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>   	 * See function amdgpu_display_supported_domains()
>   	 */
>   	if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
> -		domain = AMDGPU_GEM_DOMAIN_VRAM;
> -		if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
> +		if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
> +			domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user really wants vram, respect it */
> +		else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
> +			domain = AMDGPU_GEM_DOMAIN_GTT; /* if user really wants gtt, respect it */
> +		else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>   			domain = AMDGPU_GEM_DOMAIN_GTT;
> +		else
> +			domain = AMDGPU_GEM_DOMAIN_VRAM;
>   	}
>   
>   	if (bo->pin_count) {

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

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found]     ` <4dc6cde7-fb5c-81c2-6678-8e90e1beb78e-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-05-18 18:22       ` Samuel Li
       [not found]         ` <2672d966-febd-6132-a785-01cdd04fea15-5C7GfCeVMHo@public.gmane.org>
  2018-05-18 19:12       ` Alex Deucher
  1 sibling, 1 reply; 12+ messages in thread
From: Samuel Li @ 2018-05-18 18:22 UTC (permalink / raw)
  To: Michel Dänzer, Alex Deucher
  Cc: Alex Deucher, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW



On 2018-05-18 04:21 AM, Michel Dänzer wrote:
> On 2018-05-17 06:55 PM, Alex Deucher wrote:
>> If the pin domain is set to GTT | VRAM, look at the preferred domains
>> for the bo and respect that if it's been set explicitly.
>>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> index 6a9e46ae7f0a..16192f17653e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>  	 * See function amdgpu_display_supported_domains()
>>  	 */
>>  	if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
>> -		domain = AMDGPU_GEM_DOMAIN_VRAM;
>> -		if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>> +		if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
>> +			domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user really wants vram, respect it */
>> +		else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
>> +			domain = AMDGPU_GEM_DOMAIN_GTT; /* if user really wants gtt, respect it */
> 
> I'd spell VRAM and GTT in capital letters in the comments.
> 
> 
>> +		else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>  			domain = AMDGPU_GEM_DOMAIN_GTT;
>> +		else
>> +			domain = AMDGPU_GEM_DOMAIN_VRAM;
>>  	}
> 
> Is everything in place to deal with any issues that might occur when
> flipping between buffers in VRAM and GTT?
> 
Besides this question, I am also wondering how to deal with the first display buffer created in kernel at amdgpufb_create_pinned_object()?

Sam


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

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found]     ` <4dc6cde7-fb5c-81c2-6678-8e90e1beb78e-otUistvHUpPR7s880joybQ@public.gmane.org>
  2018-05-18 18:22       ` Samuel Li
@ 2018-05-18 19:12       ` Alex Deucher
       [not found]         ` <CADnq5_OWqfzjtB2XQ4hQB8fb89G=Bmx4LtJvCEHdCKDjnHZkUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Alex Deucher @ 2018-05-18 19:12 UTC (permalink / raw)
  To: Michel Dänzer; +Cc: Alex Deucher, amd-gfx list

On Fri, May 18, 2018 at 4:21 AM, Michel Dänzer <michel@daenzer.net> wrote:
> On 2018-05-17 06:55 PM, Alex Deucher wrote:
>> If the pin domain is set to GTT | VRAM, look at the preferred domains
>> for the bo and respect that if it's been set explicitly.
>>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> index 6a9e46ae7f0a..16192f17653e 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>        * See function amdgpu_display_supported_domains()
>>        */
>>       if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
>> -             domain = AMDGPU_GEM_DOMAIN_VRAM;
>> -             if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>> +             if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
>> +                     domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user really wants vram, respect it */
>> +             else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
>> +                     domain = AMDGPU_GEM_DOMAIN_GTT; /* if user really wants gtt, respect it */
>
> I'd spell VRAM and GTT in capital letters in the comments.

OK.

>
>
>> +             else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>                       domain = AMDGPU_GEM_DOMAIN_GTT;
>> +             else
>> +                     domain = AMDGPU_GEM_DOMAIN_VRAM;
>>       }
>
> Is everything in place to deal with any issues that might occur when
> flipping between buffers in VRAM and GTT?
>

Ah, right, I forgot about that, we still need to do that.  In practice
I don't think this will change anything compared things now at least
the way mesa is currently configured.  I can hold off on this this
patch for now until we handle that if you think it will be an issue.

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

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found]         ` <2672d966-febd-6132-a785-01cdd04fea15-5C7GfCeVMHo@public.gmane.org>
@ 2018-05-18 19:16           ` Alex Deucher
       [not found]             ` <CADnq5_O+y23n9wKdWNbTk8phx34Tt3Cj3NRQ2AqN=qAmYrxppQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Alex Deucher @ 2018-05-18 19:16 UTC (permalink / raw)
  To: Samuel Li; +Cc: Alex Deucher, Michel Dänzer, amd-gfx list

On Fri, May 18, 2018 at 2:22 PM, Samuel Li <samuel.li@amd.com> wrote:
>
>
> On 2018-05-18 04:21 AM, Michel Dänzer wrote:
>> On 2018-05-17 06:55 PM, Alex Deucher wrote:
>>> If the pin domain is set to GTT | VRAM, look at the preferred domains
>>> for the bo and respect that if it's been set explicitly.
>>>
>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>> ---
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> index 6a9e46ae7f0a..16192f17653e 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>>       * See function amdgpu_display_supported_domains()
>>>       */
>>>      if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
>>> -            domain = AMDGPU_GEM_DOMAIN_VRAM;
>>> -            if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>> +            if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user really wants vram, respect it */
>>> +            else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
>>> +                    domain = AMDGPU_GEM_DOMAIN_GTT; /* if user really wants gtt, respect it */
>>
>> I'd spell VRAM and GTT in capital letters in the comments.
>>
>>
>>> +            else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>>                      domain = AMDGPU_GEM_DOMAIN_GTT;
>>> +            else
>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>      }
>>
>> Is everything in place to deal with any issues that might occur when
>> flipping between buffers in VRAM and GTT?
>>
> Besides this question, I am also wondering how to deal with the first display buffer created in kernel at amdgpufb_create_pinned_object()?

amdgpufb_create_pinned_object() calls
amdgpu_display_supported_domains() for the initial domain and
amdgpu_gem_object_create() uses that for the preferred domain so it
won't change the behavior there.

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

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found]             ` <CADnq5_O+y23n9wKdWNbTk8phx34Tt3Cj3NRQ2AqN=qAmYrxppQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-05-19 15:59               ` Christian König
       [not found]                 ` <7d9abb21-8cd9-c860-8fd1-5e8a74278a01-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Christian König @ 2018-05-19 15:59 UTC (permalink / raw)
  To: Alex Deucher, Samuel Li; +Cc: Alex Deucher, Michel Dänzer, amd-gfx list

Am 18.05.2018 um 21:16 schrieb Alex Deucher:
> On Fri, May 18, 2018 at 2:22 PM, Samuel Li <samuel.li@amd.com> wrote:
>>
>> On 2018-05-18 04:21 AM, Michel Dänzer wrote:
>>> On 2018-05-17 06:55 PM, Alex Deucher wrote:
>>>> If the pin domain is set to GTT | VRAM, look at the preferred domains
>>>> for the bo and respect that if it's been set explicitly.
>>>>
>>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>>> ---
>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>>>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>> index 6a9e46ae7f0a..16192f17653e 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,
>>>>        * See function amdgpu_display_supported_domains()
>>>>        */
>>>>       if (domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) {
>>>> -            domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>> -            if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>>> +            if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
>>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user really wants vram, respect it */
>>>> +            else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
>>>> +                    domain = AMDGPU_GEM_DOMAIN_GTT; /* if user really wants gtt, respect it */
>>> I'd spell VRAM and GTT in capital letters in the comments.
>>>
>>>
>>>> +            else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>>>                       domain = AMDGPU_GEM_DOMAIN_GTT;
>>>> +            else
>>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>>       }
>>> Is everything in place to deal with any issues that might occur when
>>> flipping between buffers in VRAM and GTT?
>>>
>> Besides this question, I am also wondering how to deal with the first display buffer created in kernel at amdgpufb_create_pinned_object()?
> amdgpufb_create_pinned_object() calls
> amdgpu_display_supported_domains() for the initial domain and
> amdgpu_gem_object_create() uses that for the preferred domain so it
> won't change the behavior there.

That was actually something I was not sure about when I initially 
created the patch.

See the FB emulation expects some pointer into a linear PCI resource 
(VRAM), I'm not sure if that can actually deal with something kmapped 
into the vmap (GTT).

Since this is seldom used and only with low resolution it might be 
better to do the conservative approach and use VRAM here.

And we do a full mode set when switching away from FB emulation AFAIK, 
so the move from VRAM to GTT shouldn't be a problem.

Christian.

>
> Alex
> _______________________________________________
> 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] 12+ messages in thread

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found]                 ` <7d9abb21-8cd9-c860-8fd1-5e8a74278a01-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2018-05-22  7:22                   ` Michel Dänzer
       [not found]                     ` <261e78e9-99d7-ce99-9866-701bce2e639a-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2018-05-22  7:22 UTC (permalink / raw)
  To: christian.koenig-5C7GfCeVMHo, Alex Deucher, Samuel Li
  Cc: Alex Deucher, amd-gfx list

On 2018-05-19 05:59 PM, Christian König wrote:
> Am 18.05.2018 um 21:16 schrieb Alex Deucher:
>> On Fri, May 18, 2018 at 2:22 PM, Samuel Li <samuel.li@amd.com> wrote:
>>>
>>> On 2018-05-18 04:21 AM, Michel Dänzer wrote:
>>>> On 2018-05-17 06:55 PM, Alex Deucher wrote:
>>>>> If the pin domain is set to GTT | VRAM, look at the preferred domains
>>>>> for the bo and respect that if it's been set explicitly.
>>>>>
>>>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>>>> ---
>>>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>>>>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>> index 6a9e46ae7f0a..16192f17653e 100644
>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo
>>>>> *bo, u32 domain,
>>>>>        * See function amdgpu_display_supported_domains()
>>>>>        */
>>>>>       if (domain == (AMDGPU_GEM_DOMAIN_VRAM |
>>>>> AMDGPU_GEM_DOMAIN_GTT)) {
>>>>> -            domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>>> -            if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>>>> +            if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
>>>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user
>>>>> really wants vram, respect it */
>>>>> +            else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
>>>>> +                    domain = AMDGPU_GEM_DOMAIN_GTT; /* if user
>>>>> really wants gtt, respect it */
>>>> I'd spell VRAM and GTT in capital letters in the comments.
>>>>
>>>>
>>>>> +            else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>>>>                       domain = AMDGPU_GEM_DOMAIN_GTT;
>>>>> +            else
>>>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>>>       }
>>>> Is everything in place to deal with any issues that might occur when
>>>> flipping between buffers in VRAM and GTT?
>>>>
>>> Besides this question, I am also wondering how to deal with the first
>>> display buffer created in kernel at amdgpufb_create_pinned_object()?
>> amdgpufb_create_pinned_object() calls
>> amdgpu_display_supported_domains() for the initial domain and
>> amdgpu_gem_object_create() uses that for the preferred domain so it
>> won't change the behavior there.
> 
> That was actually something I was not sure about when I initially
> created the patch.
> 
> See the FB emulation expects some pointer into a linear PCI resource
> (VRAM), I'm not sure if that can actually deal with something kmapped
> into the vmap (GTT).
> 
> Since this is seldom used and only with low resolution

It's not that low resolution these days (normally the smallest native
resolution of all connected displays, i.e. generally >= 1920x1080), i.e.
on the order of ~10 MB of VRAM that can't be used for anything else.

> it might be better to do the conservative approach and use VRAM here.

Or somebody could try forcing GTT for this, and see what happens. :) If
it works, I'd say GTT is actually preferable for this.


> And we do a full mode set when switching away from FB emulation AFAIK,
> so the move from VRAM to GTT shouldn't be a problem.

Agreed.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found]                     ` <261e78e9-99d7-ce99-9866-701bce2e639a-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-05-22  9:11                       ` Christian König
       [not found]                         ` <666cebe0-1878-bbbb-e9f9-9fdb645a1cbc-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Christian König @ 2018-05-22  9:11 UTC (permalink / raw)
  To: Michel Dänzer, Alex Deucher, Samuel Li; +Cc: Alex Deucher, amd-gfx list

Am 22.05.2018 um 09:22 schrieb Michel Dänzer:
> On 2018-05-19 05:59 PM, Christian König wrote:
>> Am 18.05.2018 um 21:16 schrieb Alex Deucher:
>>> On Fri, May 18, 2018 at 2:22 PM, Samuel Li <samuel.li@amd.com> wrote:
>>>> On 2018-05-18 04:21 AM, Michel Dänzer wrote:
>>>>> On 2018-05-17 06:55 PM, Alex Deucher wrote:
>>>>>> If the pin domain is set to GTT | VRAM, look at the preferred domains
>>>>>> for the bo and respect that if it's been set explicitly.
>>>>>>
>>>>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>>>>> ---
>>>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>>>>>>    1 file changed, 7 insertions(+), 2 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>> index 6a9e46ae7f0a..16192f17653e 100644
>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo
>>>>>> *bo, u32 domain,
>>>>>>         * See function amdgpu_display_supported_domains()
>>>>>>         */
>>>>>>        if (domain == (AMDGPU_GEM_DOMAIN_VRAM |
>>>>>> AMDGPU_GEM_DOMAIN_GTT)) {
>>>>>> -            domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>>>> -            if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>>>>> +            if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
>>>>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user
>>>>>> really wants vram, respect it */
>>>>>> +            else if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_GTT)
>>>>>> +                    domain = AMDGPU_GEM_DOMAIN_GTT; /* if user
>>>>>> really wants gtt, respect it */
>>>>> I'd spell VRAM and GTT in capital letters in the comments.
>>>>>
>>>>>
>>>>>> +            else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>>>>>                        domain = AMDGPU_GEM_DOMAIN_GTT;
>>>>>> +            else
>>>>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>>>>        }
>>>>> Is everything in place to deal with any issues that might occur when
>>>>> flipping between buffers in VRAM and GTT?
>>>>>
>>>> Besides this question, I am also wondering how to deal with the first
>>>> display buffer created in kernel at amdgpufb_create_pinned_object()?
>>> amdgpufb_create_pinned_object() calls
>>> amdgpu_display_supported_domains() for the initial domain and
>>> amdgpu_gem_object_create() uses that for the preferred domain so it
>>> won't change the behavior there.
>> That was actually something I was not sure about when I initially
>> created the patch.
>>
>> See the FB emulation expects some pointer into a linear PCI resource
>> (VRAM), I'm not sure if that can actually deal with something kmapped
>> into the vmap (GTT).
>>
>> Since this is seldom used and only with low resolution
> It's not that low resolution these days (normally the smallest native
> resolution of all connected displays, i.e. generally >= 1920x1080), i.e.
> on the order of ~10 MB of VRAM that can't be used for anything else.

Hui, what? Isn't the fb freed after X takes over?

>> it might be better to do the conservative approach and use VRAM here.
> Or somebody could try forcing GTT for this, and see what happens. :) If
> it works, I'd say GTT is actually preferable for this.

GTT is certainly preferable. Could just be that some common fb code 
calls io*map() on this and wonders why that fails horrible :)

I think as long as we don't see a crash during startup with boot screens 
everything should be fine.

Christian.

>> And we do a full mode set when switching away from FB emulation AFAIK,
>> so the move from VRAM to GTT shouldn't be a problem.
> Agreed.
>
>

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

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found]                         ` <666cebe0-1878-bbbb-e9f9-9fdb645a1cbc-5C7GfCeVMHo@public.gmane.org>
@ 2018-05-22  9:26                           ` Michel Dänzer
       [not found]                             ` <c695e7bd-ea92-3249-dbc4-38ef2cbb3199-otUistvHUpPR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Michel Dänzer @ 2018-05-22  9:26 UTC (permalink / raw)
  To: Christian König, Alex Deucher, Samuel Li; +Cc: Alex Deucher, amd-gfx list

On 2018-05-22 11:11 AM, Christian König wrote:
> Am 22.05.2018 um 09:22 schrieb Michel Dänzer:
>> On 2018-05-19 05:59 PM, Christian König wrote:
>>> Am 18.05.2018 um 21:16 schrieb Alex Deucher:
>>>> On Fri, May 18, 2018 at 2:22 PM, Samuel Li <samuel.li@amd.com> wrote:
>>>>> On 2018-05-18 04:21 AM, Michel Dänzer wrote:
>>>>>> On 2018-05-17 06:55 PM, Alex Deucher wrote:
>>>>>>> If the pin domain is set to GTT | VRAM, look at the preferred
>>>>>>> domains
>>>>>>> for the bo and respect that if it's been set explicitly.
>>>>>>>
>>>>>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>>>>>>> ---
>>>>>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
>>>>>>>    1 file changed, 7 insertions(+), 2 deletions(-)
>>>>>>>
>>>>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>>> index 6a9e46ae7f0a..16192f17653e 100644
>>>>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
>>>>>>> @@ -704,9 +704,14 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo
>>>>>>> *bo, u32 domain,
>>>>>>>         * See function amdgpu_display_supported_domains()
>>>>>>>         */
>>>>>>>        if (domain == (AMDGPU_GEM_DOMAIN_VRAM |
>>>>>>> AMDGPU_GEM_DOMAIN_GTT)) {
>>>>>>> -            domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>>>>> -            if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>>>>>> +            if (bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM)
>>>>>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM; /* if user
>>>>>>> really wants vram, respect it */
>>>>>>> +            else if (bo->preferred_domains ==
>>>>>>> AMDGPU_GEM_DOMAIN_GTT)
>>>>>>> +                    domain = AMDGPU_GEM_DOMAIN_GTT; /* if user
>>>>>>> really wants gtt, respect it */
>>>>>> I'd spell VRAM and GTT in capital letters in the comments.
>>>>>>
>>>>>>
>>>>>>> +            else if (adev->gmc.real_vram_size <=
>>>>>>> AMDGPU_SG_THRESHOLD)
>>>>>>>                        domain = AMDGPU_GEM_DOMAIN_GTT;
>>>>>>> +            else
>>>>>>> +                    domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>>>>>        }
>>>>>> Is everything in place to deal with any issues that might occur when
>>>>>> flipping between buffers in VRAM and GTT?
>>>>>>
>>>>> Besides this question, I am also wondering how to deal with the first
>>>>> display buffer created in kernel at amdgpufb_create_pinned_object()?
>>>> amdgpufb_create_pinned_object() calls
>>>> amdgpu_display_supported_domains() for the initial domain and
>>>> amdgpu_gem_object_create() uses that for the preferred domain so it
>>>> won't change the behavior there.
>>> That was actually something I was not sure about when I initially
>>> created the patch.
>>>
>>> See the FB emulation expects some pointer into a linear PCI resource
>>> (VRAM), I'm not sure if that can actually deal with something kmapped
>>> into the vmap (GTT).
>>>
>>> Since this is seldom used and only with low resolution
>> It's not that low resolution these days (normally the smallest native
>> resolution of all connected displays, i.e. generally >= 1920x1080), i.e.
>> on the order of ~10 MB of VRAM that can't be used for anything else.
> 
> Hui, what? Isn't the fb freed after X takes over?

Nope, that isn't possible (not even un-pinning it from VRAM), because
the console layer can try accessing the buffer at any time from any context.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found]                             ` <c695e7bd-ea92-3249-dbc4-38ef2cbb3199-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2018-05-22 10:04                               ` Christian König
  0 siblings, 0 replies; 12+ messages in thread
From: Christian König @ 2018-05-22 10:04 UTC (permalink / raw)
  To: Michel Dänzer, Christian König, Alex Deucher, Samuel Li
  Cc: Alex Deucher, amd-gfx list

[SNIP]
>>> It's not that low resolution these days (normally the smallest native
>>> resolution of all connected displays, i.e. generally >= 1920x1080), i.e.
>>> on the order of ~10 MB of VRAM that can't be used for anything else.
>> Hui, what? Isn't the fb freed after X takes over?
> Nope, that isn't possible (not even un-pinning it from VRAM), because
> the console layer can try accessing the buffer at any time from any context.

Ok, that at least explains why people are wanting to get rid of it so 
desperately :)

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

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

* Re: [PATCH] drm/amdgpu: consider user preference when pinning for SG display
       [not found]         ` <CADnq5_OWqfzjtB2XQ4hQB8fb89G=Bmx4LtJvCEHdCKDjnHZkUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-05-22 14:24           ` Michel Dänzer
  0 siblings, 0 replies; 12+ messages in thread
From: Michel Dänzer @ 2018-05-22 14:24 UTC (permalink / raw)
  To: Alex Deucher; +Cc: Alex Deucher, amd-gfx list

On 2018-05-18 09:12 PM, Alex Deucher wrote:
> On Fri, May 18, 2018 at 4:21 AM, Michel Dänzer <michel@daenzer.net> wrote:
>> On 2018-05-17 06:55 PM, Alex Deucher wrote:
>>> If the pin domain is set to GTT | VRAM, look at the preferred domains
>>> for the bo and respect that if it's been set explicitly.
>>>
>>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>
> [...]
>
>>> +             else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>>>                       domain = AMDGPU_GEM_DOMAIN_GTT;
>>> +             else
>>> +                     domain = AMDGPU_GEM_DOMAIN_VRAM;
>>>       }
>>
>> Is everything in place to deal with any issues that might occur when
>> flipping between buffers in VRAM and GTT?
> 
> Ah, right, I forgot about that, we still need to do that.  In practice
> I don't think this will change anything compared things now at least
> the way mesa is currently configured.  I can hold off on this this
> patch for now until we handle that if you think it will be an issue.

Apart from relying on userspace behaviour, it could be an issue when a
DRI3 client using a different driver than glamor (e.g. Vulkan or
amdgpu-pro OpenGL) starts or stops page flipping (both cases involve a
flip between a server-allocated and a client-allocated buffer).


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

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

end of thread, other threads:[~2018-05-22 14:24 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-17 16:55 [PATCH] drm/amdgpu: consider user preference when pinning for SG display Alex Deucher
     [not found] ` <20180517165521.8581-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2018-05-18  8:21   ` Michel Dänzer
     [not found]     ` <4dc6cde7-fb5c-81c2-6678-8e90e1beb78e-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-05-18 18:22       ` Samuel Li
     [not found]         ` <2672d966-febd-6132-a785-01cdd04fea15-5C7GfCeVMHo@public.gmane.org>
2018-05-18 19:16           ` Alex Deucher
     [not found]             ` <CADnq5_O+y23n9wKdWNbTk8phx34Tt3Cj3NRQ2AqN=qAmYrxppQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-05-19 15:59               ` Christian König
     [not found]                 ` <7d9abb21-8cd9-c860-8fd1-5e8a74278a01-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-05-22  7:22                   ` Michel Dänzer
     [not found]                     ` <261e78e9-99d7-ce99-9866-701bce2e639a-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-05-22  9:11                       ` Christian König
     [not found]                         ` <666cebe0-1878-bbbb-e9f9-9fdb645a1cbc-5C7GfCeVMHo@public.gmane.org>
2018-05-22  9:26                           ` Michel Dänzer
     [not found]                             ` <c695e7bd-ea92-3249-dbc4-38ef2cbb3199-otUistvHUpPR7s880joybQ@public.gmane.org>
2018-05-22 10:04                               ` Christian König
2018-05-18 19:12       ` Alex Deucher
     [not found]         ` <CADnq5_OWqfzjtB2XQ4hQB8fb89G=Bmx4LtJvCEHdCKDjnHZkUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-05-22 14:24           ` Michel Dänzer
2018-05-18  9:56   ` Christian König

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.