Skip to contentSkip to conversation

drm/amdgpu: consider user preference when pinning for SG display

PATCH In review Alex Deucher 5 participants 12 messages May 17, 2018 – May 22, 2018 9 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: consider user preference when pinning for SG display

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +7 -2
index 6a9e46ae7f0a..16192f17653e 100644
@@ -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) {
Signature · 6 lines
2.13.6

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20180517165521.8581-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org

#2 lore raw
Quoted 13 lines · 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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 6a9e46ae7f0a..16192f17653e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 710

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -2
@@ -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.

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 715

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -0
+		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?

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 4dc6cde7-fb5c-81c2-6678-8e90e1beb78e-otUistvHUpPR7s880joybQ@public.gmane.org

#4 lore raw
Quoted 27 lines · Michel Dänzer
Quoted 13 lines · 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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 6a9e46ae7f0a..16192f17653e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 710

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -2
@@ -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.

Quoted 9 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 715

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -0
+		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

Quoted 1 line

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 2672d966-febd-6132-a785-01cdd04fea15-5C7GfCeVMHo@public.gmane.org

#6 lore raw
Quoted 36 lines · Samuel Li
Quoted 33 lines · Michel Dänzer
Quoted 13 lines · 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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 6a9e46ae7f0a..16192f17653e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 710

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -2
@@ -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.

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -0
+            else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
                     domain = AMDGPU_GEM_DOMAIN_GTT;
+            else
+                    domain = AMDGPU_GEM_DOMAIN_VRAM;
     }
Quoted 4 lines
Quoted 3 lines

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_O+y23n9wKdWNbTk8phx34Tt3Cj3NRQ2AqN=qAmYrxppQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw

Am 18.05.2018 um 21:16 schrieb Alex Deucher:

Quoted 34 lines · Samuel Li
Quoted 33 lines · Michel Dänzer
Quoted 31 lines · Alex Deucher
Quoted 13 lines

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.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 6a9e46ae7f0a..16192f17653e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 710

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -2
@@ -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.

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -0
+            else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
                      domain = AMDGPU_GEM_DOMAIN_GTT;
+            else
+                    domain = AMDGPU_GEM_DOMAIN_VRAM;
      }
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

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.

Quoted 6 lines

Alex
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 7d9abb21-8cd9-c860-8fd1-5e8a74278a01-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#10 lore raw
Quoted 50 lines · Christian König

Am 18.05.2018 um 21:16 schrieb Alex Deucher:

Quoted 42 lines · Samuel Li
Quoted 41 lines · Michel Dänzer
Quoted 39 lines · Alex Deucher
Quoted 19 lines

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.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--

  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 6a9e46ae7f0a..16192f17653e 100644
@@ -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)) {

Quoted 8 lines

-            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.

Quoted 5 lines

+            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?

Quoted 6 lines
Quoted 2 lines

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.

Quoted 8 lines

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.

Quoted 1 line

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.

Quoted 2 lines

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.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 261e78e9-99d7-ce99-9866-701bce2e639a-otUistvHUpPR7s880joybQ@public.gmane.org

#12 lore raw

Am 22.05.2018 um 09:22 schrieb Michel Dänzer:

Quoted 52 lines · Christian König
Quoted 51 lines

Am 18.05.2018 um 21:16 schrieb Alex Deucher:

Quoted 41 lines · Samuel Li
Quoted 40 lines · Michel Dänzer
Quoted 39 lines · Alex Deucher
Quoted 23 lines

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.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
   1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -2
index 6a9e46ae7f0a..16192f17653e 100644
@@ -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
Quoted 4 lines

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.

Quoted 5 lines

+            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?

Quoted 6 lines
Quoted 2 lines

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.

Quoted 8 lines
Quoted 5 lines

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?

Quoted 3 lines
Quoted 1 line

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.

Quoted 5 lines
Quoted 2 lines

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 666cebe0-1878-bbbb-e9f9-9fdb645a1cbc-5C7GfCeVMHo@public.gmane.org

#14 lore raw
Quoted 60 lines · Christian König

Am 22.05.2018 um 09:22 schrieb Michel Dänzer:

Quoted 59 lines · Christian König
Quoted 58 lines

Am 18.05.2018 um 21:16 schrieb Alex Deucher:

Quoted 44 lines · Samuel Li
Quoted 43 lines · Michel Dänzer
Quoted 42 lines · Alex Deucher
Quoted 21 lines

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.

---
   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--

   1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 6a9e46ae7f0a..16192f17653e 100644
@@ -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;

Quoted 8 lines

-            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.

Quoted 6 lines

+            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?

Quoted 6 lines
Quoted 2 lines

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).

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

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.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): c695e7bd-ea92-3249-dbc4-38ef2cbb3199-otUistvHUpPR7s880joybQ@public.gmane.org

#16 lore raw

[SNIP]

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#17 lore raw
In reply to a message not in the archive
Quoted 9 lines · Michel Dänzer
Quoted 8 lines · 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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0 -0
index 6a9e46ae7f0a..16192f17653e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 710

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +4 -2
@@ -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.

Quoted 11 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 715

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -0
+             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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_OWqfzjtB2XQ4hQB8fb89G=Bmx4LtJvCEHdCKDjnHZkUQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#19 lore raw
Quoted 15 lines · Alex Deucher
Quoted 5 lines · Michel Dänzer
Quoted 4 lines · 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.

[...]

Quoted 6 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -0
+             else if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
                      domain = AMDGPU_GEM_DOMAIN_GTT;
+             else
+                     domain = AMDGPU_GEM_DOMAIN_VRAM;
      }
Quoted 7 lines
Quoted 2 lines

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).

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#20 lore raw
In reply to a message not in the archive

Am 17.05.2018 um 18:55 schrieb Alex Deucher:

Quoted 4 lines

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.

Quoted 15 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -2
index 6a9e46ae7f0a..16192f17653e 100644
@@ -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)

drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 717

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +6 -0
+			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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx