drm/amdgpu: Enable scatter gather display support
Subsystems (2)
PATCH 3/3 drm/amdgpu: Enable scatter gather display support
It's auto by default. For CZ/ST, auto setting enables sg display when vram size is small; otherwise still uses vram. This patch fixed some potention issues introduced by change "allow framebuffer in GART memory as well" due to CZ/ST hardware limitation.
v2: Change default setting to auto.
v3: Move some logic from amdgpu_display_framebuffer_domains()
to pin function, suggested by Christian.
v4: Split into several patches.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++++++++++ 3 files changed, 17 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -129,6 +129,7 @@ extern int amdgpu_lbpw;extern int amdgpu_compute_multipipe;extern int amdgpu_gpu_recovery;extern int amdgpu_emu_mode; +extern int amdgpu_sg_display;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;
@@ -137,6 +138,7 @@ extern int amdgpu_si_support;extern int amdgpu_cik_support;#endif +#define AMDGPU_SG_THRESHOLD (256*1024*1024)#define AMDGPU_DEFAULT_GTT_SIZE_MB 3072ULL/* 3GB by default */ #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000#define AMDGPU_MAX_USEC_TIMEOUT 100000/* 100 ms */
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
@@ -132,6 +132,7 @@ int amdgpu_lbpw = -1;int amdgpu_compute_multipipe =-1 ;int amdgpu_gpu_recovery =-1 ;/* auto */ int amdgpu_emu_mode =0 ; +int amdgpu_sg_display =-1 ;MODULE_PARM_DESC (vramlimit,"Restrict VRAM for testing, in megabytes" );module_param_named (vramlimit, amdgpu_vram_limit, int,0600 );
@@ -290,6 +291,9 @@ module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444);MODULE_PARM_DESC (emu_mode,"Emulation mode, (1 = enable, 0 = disable)" );module_param_named (emu_mode, amdgpu_emu_mode, int,0444 ); +MODULE_PARM_DESC (sg_display,"Enable scatter gather display, (1 = enable, 0 = disable, -1 = auto" ); +module_param_named (sg_display, amdgpu_sg_display, int,0444 ); +#ifdef CONFIG_DRM_AMDGPU_SI #if defined(CONFIG_DRM_RADEON ) || defined(CONFIG_DRM_RADEON_MODULE )
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +11 -0
@@ -696,6 +696,17 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,return -EINVAL ; } +/* This assumes only apu display buffers pin with (VRAM|GTT) */ +if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { + domain =AMDGPU_GEM_DOMAIN_VRAM ; +if (amdgpu_sg_display ==1 ) + domain =AMDGPU_GEM_DOMAIN_GTT ; +else if (amdgpu_sg_display ==-1 ) { +if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) + domain =AMDGPU_GEM_DOMAIN_GTT ; + } + } +if (bo->pin_count) {uint32_t mem_type = bo->tbo.mem.mem_type;
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1524088285-9344-1-git-send-email-Samuel.Li-5C7GfCeVMHo@public.gmane.org
Quoted 68 lines · Samuel Li
It's auto by default. For CZ/ST, auto setting enables sg display when vram size is small; otherwise still uses vram. This patch fixed some potention issues introduced by change "allow framebuffer in GART memory as well" due to CZ/ST hardware limitation.
v2: Change default setting to auto.
v3: Move some logic fromamdgpu_display_framebuffer_domains()
to pin function, suggested by Christian.
v4: Split into several patches.Signed-off-by Samuel Li <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 11 +++++++++++ 3 files changed, 17 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +2
-0@@ -129,6 +129,7 @@ extern int amdgpu_lbpw;extern int amdgpu_compute_multipipe;extern int amdgpu_gpu_recovery;extern int amdgpu_emu_mode; +extern int amdgpu_sg_display;#ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support;@@ -137,6 +138,7 @@ extern int amdgpu_si_support;extern int amdgpu_cik_support;#endif +#define AMDGPU_SG_THRESHOLD (256*1024*1024)#define AMDGPU_DEFAULT_GTT_SIZE_MB 3072ULL/* 3GB by default */ #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000#define AMDGPU_MAX_USEC_TIMEOUT 100000/* 100 ms */ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4
-0@@ -132,6 +132,7 @@ int amdgpu_lbpw = -1;int amdgpu_compute_multipipe =-1 ;int amdgpu_gpu_recovery =-1 ;/* auto */ int amdgpu_emu_mode =0 ; +int amdgpu_sg_display =-1 ;MODULE_PARM_DESC (vramlimit,"Restrict VRAM for testing, in megabytes" );module_param_named (vramlimit, amdgpu_vram_limit, int,0600 );@@ -290,6 +291,9 @@ module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444);MODULE_PARM_DESC (emu_mode,"Emulation mode, (1 = enable, 0 = disable)" );module_param_named (emu_mode, amdgpu_emu_mode, int,0444 ); +MODULE_PARM_DESC (sg_display,"Enable scatter gather display, (1 = enable, 0 = disable, -1 = auto" ); +module_param_named (sg_display, amdgpu_sg_display, int,0444 ); +#ifdef CONFIG_DRM_AMDGPU_SI #if defined(CONFIG_DRM_RADEON ) || defined(CONFIG_DRM_RADEON_MODULE )drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +0
-0@@ -696,6 +696,17 @@ int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain,return -EINVAL ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c int amdgpu_bo_pin_restricted(struct amdgpu_bo *bo, u32 domain, · line 708
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +10
-0+/* This assumes only apu display buffers pin with (VRAM|GTT) */ +if (domain == (AMDGPU_GEM_DOMAIN_VRAM |AMDGPU_GEM_DOMAIN_GTT )) { + domain =AMDGPU_GEM_DOMAIN_VRAM ; +if (amdgpu_sg_display ==1 ) + domain =AMDGPU_GEM_DOMAIN_GTT ; +else if (amdgpu_sg_display ==-1 ) { +if (adev->gmc.real_vram_size <=AMDGPU_SG_THRESHOLD ) + domain =AMDGPU_GEM_DOMAIN_GTT ; + } + }
Please drop the module parameter. I can't see any reason for it. We are ending up with too many driver parameters of questionable value. If the user would prefer GTT over VRAM or vice versa, we should take those preferences (from the UMDs) into account at pinning time as I said earlier rather than globally at as a driver option. E.g.,
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; /* if vram is limited, use gtt */
else
domain = AMDGPU_GEM_DOMAIN_VRAM;
Alex
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1
-1+if (bo->pin_count) {uint32_t mem_type = bo->tbo.mem.mem_type; --2.7.4
_______________________________________________
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