Skip to contentSkip to conversation

drm/radeon: Fix vram_size/visible values in DRM_RADEON_GEM_INFO ioctl

PATCH In review Michel Dänzer 11 participants 13 messages Jan 31, 2017 – Feb 1, 2017 6 messages not in the archive

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

PATCH 1/1 drm/radeon: Fix vram_size/visible values in DRM_RADEON_GEM_INFO ioctl

From: Michel Dänzer <[email protected]>

vram_size is supposed to be the total amount of VRAM that can be used by userspace, which corresponds to the TTM VRAM manager size (which is normally the full amount of VRAM, but can be just the visible VRAM when DMA can't be used for BO migration for some reason).

The above was incorrectly used for vram_visible before, resulting in generally too large values being reported.

---
 drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
 drivers/gpu/drm/radeon/radeon_gem.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +2 -1
index a252bc407aa2..88c41d43ec3d 100644
@@ -97,9 +97,10 @@
  *   2.46.0 - Add PFP_SYNC_ME support on evergreen
  *   2.47.0 - Add UVD_NO_OP register support
  *   2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI
+ *   2.49.0 - DRM_RADEON_GEM_INFO ioctl returns correct vram_size/visible values
  */
 #define KMS_DRIVER_MAJOR	2
-#define KMS_DRIVER_MINOR	48
+#define KMS_DRIVER_MINOR	49
 #define KMS_DRIVER_PATCHLEVEL	0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);
drivers/gpu/drm/radeon/radeon_gem.c +2 -2
index 0bcffd8a7bd3..96683f5b2b1b 100644
@@ -220,8 +220,8 @@ int radeon_gem_info_ioctl(struct drm_device *dev, void *data,
 
 	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
 
-	args->vram_size = rdev->mc.real_vram_size;
-	args->vram_visible = (u64)man->size << PAGE_SHIFT;
+	args->vram_size = (u64)man->size << PAGE_SHIFT;
+	args->vram_visible = rdev->mc.visible_vram_size;
 	args->vram_visible -= rdev->vram_pin_size;
 	args->gart_size = rdev->mc.gtt_size;
 	args->gart_size -= rdev->gart_pin_size;
Signature · 6 lines
2.11.0

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

A message that is not in the archive (sent off-list or not yet received): 20170131065414.2434-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH 1/1 winsys/radeon: Allow visible VRAM size > 256MB with kernel driver >= 2.49

From: Michel Dänzer <[email protected]>

The kernel driver reports correct values now.

---
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +6 -1
index a8da62fd36..cacd683879 100644
@@ -372,7 +372,12 @@ static bool do_winsys_init(struct radeon_drm_winsys *ws)
     }
     ws->info.gart_size = gem_info.gart_size;
     ws->info.vram_size = gem_info.vram_size;
-    ws->info.vram_vis_size = MIN2(gem_info.vram_visible, 256*1024*1024);
+    ws->info.vram_vis_size = gem_info.vram_visible;
+    /* Older versions of the kernel driver reported incorrect values, and
+     * didn't support more than 256MB of visible VRAM anyway
+     */
+    if (ws->info.drm_minor < 49)
+        ws->info.vram_vis_size = MIN2(ws->info.vram_vis_size, 256*1024*1024);
 
     /* Radeon allocates all buffers as contigous, which makes large allocations
      * unlikely to succeed. */
Signature · 6 lines
2.11.0

_______________________________________________
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): 20170131065414.2434-2-michel-otUistvHUpPR7s880joybQ@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH] winsys/radeon: Allow visible VRAM size > 256MB with kernel driver >= 2.49

Thanks for fixing this Michel.

Quoted 18 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

The kernel driver reports correct values now.

---
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +0 -0
index a8da62fd36..cacd683879 100644
@@ -372,7 +372,12 @@ static bool do_winsys_init(struct radeon_drm_winsys *ws)
     }
     ws->info.gart_size = gem_info.gart_size;
     ws->info.vram_size = gem_info.vram_size;

src/gallium/winsys/radeon/drm/radeon_drm_winsys.c static bool do_winsys_init(struct radeon_drm_winsys *ws) · line 383

Quoted 10 lines
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +6 -1
-    ws->info.vram_vis_size = MIN2(gem_info.vram_visible, 256*1024*1024);
+    ws->info.vram_vis_size = gem_info.vram_visible;
+    /* Older versions of the kernel driver reported incorrect values, and
+     * didn't support more than 256MB of visible VRAM anyway
+     */
+    if (ws->info.drm_minor < 49)
+        ws->info.vram_vis_size = MIN2(ws->info.vram_vis_size, 256*1024*1024);
 
     /* Radeon allocates all buffers as contigous, which makes large allocations
      * unlikely to succeed. */

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

Reviewed-by
#5 lore raw

Re: [PATCH] winsys/radeon: Allow visible VRAM size > 256MB with kernel driver >= 2.49

In reply to a message not in the archive

Both patches:

Quoted 18 lines · Michel Dänzer

From: Michel Dänzer <[email protected]>

The kernel driver reports correct values now.

---
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +0 -0
index a8da62fd36..cacd683879 100644
@@ -372,7 +372,12 @@ static bool do_winsys_init(struct radeon_drm_winsys *ws)
     }
     ws->info.gart_size = gem_info.gart_size;
     ws->info.vram_size = gem_info.vram_size;

src/gallium/winsys/radeon/drm/radeon_drm_winsys.c static bool do_winsys_init(struct radeon_drm_winsys *ws) · line 383

Quoted 10 lines
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +6 -1
-    ws->info.vram_vis_size = MIN2(gem_info.vram_visible, 256*1024*1024);
+    ws->info.vram_vis_size = gem_info.vram_visible;
+    /* Older versions of the kernel driver reported incorrect values, and
+     * didn't support more than 256MB of visible VRAM anyway
+     */
+    if (ws->info.drm_minor < 49)
+        ws->info.vram_vis_size = MIN2(ws->info.vram_vis_size, 256*1024*1024);
 
     /* Radeon allocates all buffers as contigous, which makes large allocations
      * unlikely to succeed. */

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

Reviewed-by Alex Deucher
#6 lore raw

RE: [PATCH] winsys/radeon: Allow visible VRAM size > 256MB with kernel driver >= 2.49

In reply to a message not in the archive
Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Tuesday, January 31, 2017 1:54 AM
To: [email protected]; [email protected]
Subject: [PATCH] winsys/radeon: Allow visible VRAM size > 256MB with kernel driver >= 2.49

Quoted 5 lines

From: Michel Dänzer <[email protected]>

The kernel driver reports correct values now.

Quoted 28 lines
---
 src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +6 -1
index a8da62fd36..cacd683879 100644
@@ -372,7 +372,12 @@ static bool do_winsys_init(struct
 radeon_drm_winsys *ws)
     }
     ws->info.gart_size = gem_info.gart_size;
     ws->info.vram_size = gem_info.vram_size;
-    ws->info.vram_vis_size = MIN2(gem_info.vram_visible, 256*1024*1024);
+    ws->info.vram_vis_size = gem_info.vram_visible;
+    /* Older versions of the kernel driver reported incorrect values, and
+     * didn't support more than 256MB of visible VRAM anyway
+     */
+    if (ws->info.drm_minor < 49)
+        ws->info.vram_vis_size = MIN2(ws->info.vram_vis_size,
 256*1024*1024);
 

/* Radeon allocates all buffers as contigous, which makes large allocations
* unlikely to succeed. */
--
2.11.0

Quoted 4 lines

_______________________________________________
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

Reviewed-by
#7 lore raw
In reply to a message not in the archive

Am 31.01.2017 um 07:54 schrieb Michel Dänzer:

Quoted 11 lines

From: Michel Dänzer <[email protected]>

vram_size is supposed to be the total amount of VRAM that can be used by userspace, which corresponds to the TTM VRAM manager size (which is normally the full amount of VRAM, but can be just the visible VRAM when DMA can't be used for BO migration for some reason).

The above was incorrectly used for vram_visible before, resulting in generally too large values being reported.

Good catch, I wonder how long we have that in here.

Regards,
Christian.

Quoted 26 lines
---
  drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
  drivers/gpu/drm/radeon/radeon_gem.c | 4 ++--
  2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +2 -1
index a252bc407aa2..88c41d43ec3d 100644
@@ -97,9 +97,10 @@
   *   2.46.0 - Add PFP_SYNC_ME support on evergreen
   *   2.47.0 - Add UVD_NO_OP register support
   *   2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI
+ *   2.49.0 - DRM_RADEON_GEM_INFO ioctl returns correct vram_size/visible values
   */
  #define KMS_DRIVER_MAJOR	2
-#define KMS_DRIVER_MINOR	48
+#define KMS_DRIVER_MINOR	49
  #define KMS_DRIVER_PATCHLEVEL	0
  int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
  int radeon_driver_unload_kms(struct drm_device *dev);
drivers/gpu/drm/radeon/radeon_gem.c +0 -0
index 0bcffd8a7bd3..96683f5b2b1b 100644

drivers/gpu/drm/radeon/radeon_gem.c int radeon_gem_info_ioctl(struct drm_device *dev, void *data, · line 227

Quoted 10 lines
drivers/gpu/drm/radeon/radeon_gem.c +2 -2
@@ -220,8 +220,8 @@ int radeon_gem_info_ioctl(struct drm_device *dev, void *data,
 
  	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
 
-	args->vram_size = rdev->mc.real_vram_size;
-	args->vram_visible = (u64)man->size << PAGE_SHIFT;
+	args->vram_size = (u64)man->size << PAGE_SHIFT;
+	args->vram_visible = rdev->mc.visible_vram_size;
  	args->vram_visible -= rdev->vram_pin_size;
  	args->gart_size = rdev->mc.gtt_size;
  	args->gart_size -= rdev->gart_pin_size;

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

Reviewed-by Alex Deucher
#8 lore raw
In reply to a message not in the archive
Quoted 15 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Tuesday, January 31, 2017 1:54 AM
To: [email protected]; [email protected]
Subject: [PATCH] drm/radeon: Fix vram_size/visible values in DRM_RADEON_GEM_INFO ioctl

From: Michel Dänzer <[email protected]>

vram_size is supposed to be the total amount of VRAM that can be used by userspace, which corresponds to the TTM VRAM manager size (which is normally the full amount of VRAM, but can be just the visible VRAM when DMA can't be used for BO migration for some reason).

Quoted 4 lines

The above was incorrectly used for vram_visible before, resulting in generally too large values being reported.

Quoted 43 lines
---
 drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
 drivers/gpu/drm/radeon/radeon_gem.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +1 -0
index a252bc407aa2..88c41d43ec3d 100644
@@ -97,9 +97,10 @@
  *   2.46.0 - Add PFP_SYNC_ME support on evergreen
  *   2.47.0 - Add UVD_NO_OP register support
  *   2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI
+ *   2.49.0 - DRM_RADEON_GEM_INFO ioctl returns correct

vram_size/visible values
*/
#define KMS_DRIVER_MAJOR 2

drivers/gpu/drm/radeon/radeon_drv.c +1 -1
-#define KMS_DRIVER_MINOR	48
+#define KMS_DRIVER_MINOR	49
 #define KMS_DRIVER_PATCHLEVEL	0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags);
 int radeon_driver_unload_kms(struct drm_device *dev);
drivers/gpu/drm/radeon/radeon_gem.c +2 -2
index 0bcffd8a7bd3..96683f5b2b1b 100644
@@ -220,8 +220,8 @@ int radeon_gem_info_ioctl(struct drm_device *dev,
 void *data,
 
 	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
 
-	args->vram_size = rdev->mc.real_vram_size;
-	args->vram_visible = (u64)man->size << PAGE_SHIFT;
+	args->vram_size = (u64)man->size << PAGE_SHIFT;
+	args->vram_visible = rdev->mc.visible_vram_size;
 	args->vram_visible -= rdev->vram_pin_size;
 	args->gart_size = rdev->mc.gtt_size;

args->gart_size -= rdev->gart_pin_size;
--
2.11.0

Quoted 4 lines

_______________________________________________
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

#9 lore raw
In reply to Michel Dänzer

Hello Michel,

as this is for radeon, do you think this could/should fix the wrong reported VRAM size with Unigine_Heaven/-Valley, too? Maybe speed things up? ;-)

Unigine_Valley-1.0

GPU: Unknown GPU x1
System memory: 24102 MB
Video memory:  256 MB
Sync threads:  7
Async threads: 8

I'll try patching openSUSE Kernel:stable 4.9.6-2 with this and maybe this could then go into 4.10-rc7 'cause it is a bugfix. - Alex?

Greetings,
Dieter

Am 31.01.2017 07:54, schrieb Michel Dänzer:

Quoted 51 lines

From: Michel Dänzer <[email protected]>

vram_size is supposed to be the total amount of VRAM that can be used by userspace, which corresponds to the TTM VRAM manager size (which is normally the full amount of VRAM, but can be just the visible VRAM when DMA can't be used for BO migration for some reason).

The above was incorrectly used for vram_visible before, resulting in generally too large values being reported.

---
 drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
 drivers/gpu/drm/radeon/radeon_gem.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +1 -0
index a252bc407aa2..88c41d43ec3d 100644
@@ -97,9 +97,10 @@
  *   2.46.0 - Add PFP_SYNC_ME support on evergreen
  *   2.47.0 - Add UVD_NO_OP register support
  *   2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI
+ *   2.49.0 - DRM_RADEON_GEM_INFO ioctl returns correct

vram_size/visible values
*/
#define KMS_DRIVER_MAJOR 2

drivers/gpu/drm/radeon/radeon_drv.c +1 -1
-#define KMS_DRIVER_MINOR	48
+#define KMS_DRIVER_MINOR	49
 #define KMS_DRIVER_PATCHLEVEL	0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long 

flags);
int radeon_driver_unload_kms(struct drm_device *dev);

drivers/gpu/drm/radeon/radeon_gem.c +2 -2
index 0bcffd8a7bd3..96683f5b2b1b 100644
@@ -220,8 +220,8 @@ int radeon_gem_info_ioctl(struct drm_device *dev,
 void *data,
 
 	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
 
-	args->vram_size = rdev->mc.real_vram_size;
-	args->vram_visible = (u64)man->size << PAGE_SHIFT;
+	args->vram_size = (u64)man->size << PAGE_SHIFT;
+	args->vram_visible = rdev->mc.visible_vram_size;
 	args->vram_visible -= rdev->vram_pin_size;
 	args->gart_size = rdev->mc.gtt_size;
Quoted 1 line

args->gart_size -= rdev->gart_pin_size;

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

A message that is not in the archive (sent off-list or not yet received): 5abbe0dcb709f4624fa52f32d9e3e3d5-0hun7QTegEsDD4udEopG9Q@public.gmane.org

#11 lore raw
Quoted 24 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Dieter Nützel
Sent: Tuesday, January 31, 2017 6:25 AM
To: Michel Dänzer
Cc: Alex Deucher; [email protected]; amd- [email protected]
Subject: Re: [Mesa-dev] [PATCH] drm/radeon: Fix vram_size/visible values in DRM_RADEON_GEM_INFO ioctl

Hello Michel,

as this is for radeon, do you think this could/should fix the wrong reported VRAM size with Unigine_Heaven/-Valley, too? Maybe speed things up? ;-)

Unigine_Valley-1.0

GPU: Unknown GPU x1
System memory: 24102 MB
Video memory:  256 MB
Sync threads:  7
Async threads: 8
Quoted 3 lines

I'll try patching openSUSE Kernel:stable 4.9.6-2 with this and maybe this could then go into 4.10-rc7 'cause it is a bugfix. - Alex?

This patch just fixes the case of the HUD reporting the wrong amount of visible vram. Most 3D apps just default to 256MB if they don't know how much vram is. The problem is GL never provided a core way to determine how much vram is available on a GPU so lots of vendor specific extensions and driver specific methods popped up to address this.

Alex

Quoted 51 lines

Greetings,
Dieter

Am 31.01.2017 07:54, schrieb Michel Dänzer:

Quoted 46 lines

From: Michel Dänzer <[email protected]>

vram_size is supposed to be the total amount of VRAM that can be used by
userspace, which corresponds to the TTM VRAM manager size (which is normally the full amount of VRAM, but can be just the visible VRAM when DMA can't be used for BO migration for some reason).

The above was incorrectly used for vram_visible before, resulting in generally too large values being reported.

---
 drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
 drivers/gpu/drm/radeon/radeon_gem.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +1 -0
index a252bc407aa2..88c41d43ec3d 100644
@@ -97,9 +97,10 @@
  *   2.46.0 - Add PFP_SYNC_ME support on evergreen
  *   2.47.0 - Add UVD_NO_OP register support
  *   2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI
+ *   2.49.0 - DRM_RADEON_GEM_INFO ioctl returns correct

vram_size/visible values
*/
#define KMS_DRIVER_MAJOR 2

drivers/gpu/drm/radeon/radeon_drv.c +1 -1
-#define KMS_DRIVER_MINOR	48
+#define KMS_DRIVER_MINOR	49
 #define KMS_DRIVER_PATCHLEVEL	0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long

flags);
int radeon_driver_unload_kms(struct drm_device *dev);

drivers/gpu/drm/radeon/radeon_gem.c +0 -0
index 0bcffd8a7bd3..96683f5b2b1b 100644
@@ -220,8 +220,8 @@ int radeon_gem_info_ioctl(struct drm_device *dev,
 void *data,
 
 	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
 
Quoted 11 lines
Quoted 7 lines
drivers/gpu/drm/radeon/radeon_gem.c +2 -2
-	args->vram_size = rdev->mc.real_vram_size;
-	args->vram_visible = (u64)man->size << PAGE_SHIFT;
+	args->vram_size = (u64)man->size << PAGE_SHIFT;
+	args->vram_visible = rdev->mc.visible_vram_size;
 	args->vram_visible -= rdev->vram_pin_size;
 	args->gart_size = rdev->mc.gtt_size;

args->gart_size -= rdev->gart_pin_size;

_______________________________________________
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): BN6PR12MB16528D1DF5184C0A29572C04F74A0-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#13 lore raw

Am 31.01.2017 16:43, schrieb Deucher, Alexander:

Quoted 28 lines
Quoted 24 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Dieter Nützel
Sent: Tuesday, January 31, 2017 6:25 AM
To: Michel Dänzer
Cc: Alex Deucher; [email protected]; amd- [email protected]
Subject: Re: [Mesa-dev] [PATCH] drm/radeon: Fix vram_size/visible values in DRM_RADEON_GEM_INFO ioctl

Hello Michel,

as this is for radeon, do you think this could/should fix the wrong reported VRAM size with Unigine_Heaven/-Valley, too? Maybe speed things up? ;-)

Unigine_Valley-1.0

GPU: Unknown GPU x1
System memory: 24102 MB
Video memory:  256 MB
Sync threads:  7
Async threads: 8
Quoted 3 lines

I'll try patching openSUSE Kernel:stable 4.9.6-2 with this and maybe this could then go into 4.10-rc7 'cause it is a bugfix. - Alex?

Quoted 8 lines

This patch just fixes the case of the HUD reporting the wrong amount of visible vram. Most 3D apps just default to 256MB if they don't know how much vram is. The problem is GL never provided a core way to determine how much vram is available on a GPU so lots of vendor specific extensions and driver specific methods popped up to address this.

Alex

Ah, no hurry then.

Thanks for clarification.

Dieter

Quoted 50 lines
Quoted 50 lines

Greetings,
Dieter

Am 31.01.2017 07:54, schrieb Michel Dänzer:

Quoted 46 lines

From: Michel Dänzer <[email protected]>

vram_size is supposed to be the total amount of VRAM that can be used by
userspace, which corresponds to the TTM VRAM manager size (which is normally the full amount of VRAM, but can be just the visible VRAM when DMA can't be used for BO migration for some reason).

The above was incorrectly used for vram_visible before, resulting in generally too large values being reported.

---
 drivers/gpu/drm/radeon/radeon_drv.c | 3 ++-
 drivers/gpu/drm/radeon/radeon_gem.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +1 -0
index a252bc407aa2..88c41d43ec3d 100644
@@ -97,9 +97,10 @@
  *   2.46.0 - Add PFP_SYNC_ME support on evergreen
  *   2.47.0 - Add UVD_NO_OP register support
  *   2.48.0 - TA_CS_BC_BASE_ADDR allowed on SI
+ *   2.49.0 - DRM_RADEON_GEM_INFO ioctl returns correct

vram_size/visible values
*/
#define KMS_DRIVER_MAJOR 2

drivers/gpu/drm/radeon/radeon_drv.c +1 -1
-#define KMS_DRIVER_MINOR	48
+#define KMS_DRIVER_MINOR	49
 #define KMS_DRIVER_PATCHLEVEL	0
 int radeon_driver_load_kms(struct drm_device *dev, unsigned long

flags);
int radeon_driver_unload_kms(struct drm_device *dev);

drivers/gpu/drm/radeon/radeon_gem.c +0 -0
index 0bcffd8a7bd3..96683f5b2b1b 100644
@@ -220,8 +220,8 @@ int radeon_gem_info_ioctl(struct drm_device *dev,
 void *data,
 
 	man = &rdev->mman.bdev.man[TTM_PL_VRAM];
 
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
drivers/gpu/drm/radeon/radeon_gem.c +2 -2
-	args->vram_size = rdev->mc.real_vram_size;
-	args->vram_visible = (u64)man->size << PAGE_SHIFT;
+	args->vram_size = (u64)man->size << PAGE_SHIFT;
+	args->vram_visible = rdev->mc.visible_vram_size;
 	args->vram_visible -= rdev->vram_pin_size;
 	args->gart_size = rdev->mc.gtt_size;

args->gart_size -= rdev->gart_pin_size;

_______________________________________________
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

#14 lore raw
In reply to Deucher, Alexander
Quoted 24 lines · Alexander
Quoted 24 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Dieter Nützel
Sent: Tuesday, January 31, 2017 6:25 AM
To: Michel Dänzer
Cc: Alex Deucher; [email protected]; amd- [email protected]
Subject: Re: [Mesa-dev] [PATCH] drm/radeon: Fix vram_size/visible values in DRM_RADEON_GEM_INFO ioctl

Hello Michel,

as this is for radeon, do you think this could/should fix the wrong reported VRAM size with Unigine_Heaven/-Valley, too? Maybe speed things up? ;-)

Unigine_Valley-1.0

GPU: Unknown GPU x1
System memory: 24102 MB
Video memory:  256 MB
Sync threads:  7
Async threads: 8
Quoted 6 lines
Quoted 3 lines

I'll try patching openSUSE Kernel:stable 4.9.6-2 with this and maybe this could then go into 4.10-rc7 'cause it is a bugfix. - Alex?

This patch just fixes the case of the HUD reporting the wrong amount of visible vram. Most 3D apps just default to 256MB if they don't know how much vram is. The problem is GL never provided a core way to determine how much vram is available on a GPU so lots of vendor specific extensions and driver specific methods popped up to address this.

vram_size is used for available_texture_mem in st/nine and GLX_RENDERER_VIDEO_MEMORY_MESA via GLX_MESA_query_renderer. So maybe we want this in older/stable kernel and mesa releases ? Not sure how many apps use/honour these though ;-)

-Emil
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

A message that is not in the archive (sent off-list or not yet received): CACvgo50tFrVg+vq=Lt+5p-GYb9v+M-jRVq66rLAENFn5yoPWDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#16 lore raw
Quoted 30 lines · Emil Velikov
Quoted 28 lines · Alexander
Quoted 27 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Dieter Nützel
Sent: Tuesday, January 31, 2017 6:25 AM
To: Michel Dänzer
Cc: Alex Deucher; [email protected]; amd- [email protected]
Subject: Re: [Mesa-dev] [PATCH] drm/radeon: Fix vram_size/visible values in DRM_RADEON_GEM_INFO ioctl

Hello Michel,

as this is for radeon, do you think this could/should fix the wrong reported VRAM size with Unigine_Heaven/-Valley, too? Maybe speed things up? ;-)

Unigine_Valley-1.0

GPU: Unknown GPU x1
System memory: 24102 MB
Video memory:  256 MB
Sync threads:  7
Async threads: 8

I'll try patching openSUSE Kernel:stable 4.9.6-2 with this and maybe this could then go into 4.10-rc7 'cause it is a bugfix. - Alex?

Quoted 6 lines
Quoted 2 lines

This patch just fixes the case of the HUD reporting the wrong amount of visible vram. Most 3D apps just default to 256MB if they don't know how much vram is. The problem is GL never provided a core way to determine how much vram is available on a GPU so lots of vendor specific extensions and driver specific methods popped up to address this.

vram_size is used for available_texture_mem in st/nine and GLX_RENDERER_VIDEO_MEMORY_MESA via GLX_MESA_query_renderer. So maybe we want this in older/stable kernel and mesa releases ? Not sure how many apps use/honour these though ;-)

vram_size was always correct. it was just visible vram size that was wrong.

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_MA5NNZ=9T_U7=GG-n-AHs+VxtwksSE6v=9DSAgyZk=Xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#18 lore raw
Quoted 31 lines · Alex Deucher
Quoted 30 lines · Emil Velikov
Quoted 28 lines · Alexander
Quoted 27 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Dieter Nützel
Sent: Tuesday, January 31, 2017 6:25 AM
To: Michel Dänzer
Cc: Alex Deucher; [email protected]; amd- [email protected]
Subject: Re: [Mesa-dev] [PATCH] drm/radeon: Fix vram_size/visible values in DRM_RADEON_GEM_INFO ioctl

Hello Michel,

as this is for radeon, do you think this could/should fix the wrong reported VRAM size with Unigine_Heaven/-Valley, too? Maybe speed things up? ;-)

Unigine_Valley-1.0

GPU: Unknown GPU x1
System memory: 24102 MB
Video memory:  256 MB
Sync threads:  7
Async threads: 8

I'll try patching openSUSE Kernel:stable 4.9.6-2 with this and maybe this could then go into 4.10-rc7 'cause it is a bugfix. - Alex?

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

This patch just fixes the case of the HUD reporting the wrong amount of visible vram. Most 3D apps just default to 256MB if they don't know how much vram is. The problem is GL never provided a core way to determine how much vram is available on a GPU so lots of vendor specific extensions and driver specific methods popped up to address this.

vram_size is used for available_texture_mem in st/nine and GLX_RENDERER_VIDEO_MEMORY_MESA via GLX_MESA_query_renderer. So maybe we want this in older/stable kernel and mesa releases ? Not sure how many apps use/honour these though ;-)

vram_size was always correct. it was just visible vram size that was wrong.

Just to clarify this more: the reported visible vram size currently has no effect on anything other than scaling the Gallium HUD, which you can simply suppress if you set the ".d" option to resize it automatically I think.

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