All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] drm/amdgpu: add force_sg_display module parameter (v2)
@ 2023-01-27 17:51 Alex Deucher
  2023-01-27 17:51 ` [PATCH] drm/amd/display: add missing cyanskillfish check Alex Deucher
  2023-02-01 16:06 ` [RFC PATCH] drm/amdgpu: add force_sg_display module parameter (v2) Christian König
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Deucher @ 2023-01-27 17:51 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

Add a module parameter to force sg (scatter/gather) display
on APUs.  Normally we allow displays in both VRAM and GTT,
but this option forces displays into GTT so we can explicitly
test more scenarios with GTT.

v2: fix checks

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---

For reference since the original patch was buggy.

 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  2 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 12 ++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |  3 +++
 3 files changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 872450a3a164..73d0a0807138 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -244,6 +244,8 @@ extern int amdgpu_num_kcq;
 #define AMDGPU_VCNFW_LOG_SIZE (32 * 1024)
 extern int amdgpu_vcnfw_log;
 
+extern int amdgpu_force_sg_display;
+
 #define AMDGPU_VM_MAX_NUM_CTX			4096
 #define AMDGPU_SG_THRESHOLD			(256*1024*1024)
 #define AMDGPU_DEFAULT_GTT_SIZE_MB		3072ULL /* 3GB by default */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 4cf2028b5235..c8975c2da853 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -943,6 +943,18 @@ MODULE_PARM_DESC(smu_pptable_id,
 	"specify pptable id to be used (-1 = auto(default) value, 0 = use pptable from vbios, > 0 = soft pptable id)");
 module_param_named(smu_pptable_id, amdgpu_smu_pptable_id, int, 0444);
 
+/**
+ * DOC: force_sg_display (int)
+ * Force display buffers into GTT (scatter/gather) memory for APUs.
+ * This is used to force GTT only for displays rather than displaying from
+ * either VRAM (carve out) or GTT.
+ *
+ * Defaults to 0, or disabled.
+ */
+int amdgpu_force_sg_display;
+MODULE_PARM_DESC(force_sg_display, "Force S/G display (0 = off (default), 1 = force display to use GTT) ");
+module_param_named(force_sg_display, amdgpu_force_sg_display, int, 0444);
+
 /* These devices are not supported by amdgpu.
  * They are supported by the mach64, r128, radeon drivers
  */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 981010de0a28..840190dd78e4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -1516,6 +1516,9 @@ uint32_t amdgpu_bo_get_preferred_domain(struct amdgpu_device *adev,
 		if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
 			domain = AMDGPU_GEM_DOMAIN_GTT;
 	}
+	if ((domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) &&
+	    amdgpu_force_sg_display && adev->mode_info.gpu_vm_support)
+		domain = AMDGPU_GEM_DOMAIN_GTT;
 	return domain;
 }
 
-- 
2.39.1


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

* [PATCH] drm/amd/display: add missing cyanskillfish check
  2023-01-27 17:51 [RFC PATCH] drm/amdgpu: add force_sg_display module parameter (v2) Alex Deucher
@ 2023-01-27 17:51 ` Alex Deucher
  2023-02-01 16:06 ` [RFC PATCH] drm/amdgpu: add force_sg_display module parameter (v2) Christian König
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2023-01-27 17:51 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

For clkmgr setup.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
index 69691daf4dbb..91f7e7386da4 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
@@ -269,7 +269,8 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p
 			dcn3_clk_mgr_construct(ctx, clk_mgr, pp_smu, dccg);
 			return &clk_mgr->base;
 		}
-		if (asic_id.chip_id == DEVICE_ID_NV_13FE) {
+		if ((asic_id.chip_id == DEVICE_ID_NV_13FE) ||
+		    (asic_id.chip_id == DEVICE_ID_NV_143F)) {
 			dcn201_clk_mgr_construct(ctx, clk_mgr, pp_smu, dccg);
 			return &clk_mgr->base;
 		}
-- 
2.39.1


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

* Re: [RFC PATCH] drm/amdgpu: add force_sg_display module parameter (v2)
  2023-01-27 17:51 [RFC PATCH] drm/amdgpu: add force_sg_display module parameter (v2) Alex Deucher
  2023-01-27 17:51 ` [PATCH] drm/amd/display: add missing cyanskillfish check Alex Deucher
@ 2023-02-01 16:06 ` Christian König
  1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2023-02-01 16:06 UTC (permalink / raw)
  To: Alex Deucher, amd-gfx

Am 27.01.23 um 18:51 schrieb Alex Deucher:
> Add a module parameter to force sg (scatter/gather) display
> on APUs.  Normally we allow displays in both VRAM and GTT,
> but this option forces displays into GTT so we can explicitly
> test more scenarios with GTT.

I'm still absolutely not keen to add module parameters for internal testing.

Even with tainting the kernel this is not something we should allow end 
users to do.

Christian.

>
> v2: fix checks
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>
> For reference since the original patch was buggy.
>
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  2 ++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c    | 12 ++++++++++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c |  3 +++
>   3 files changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 872450a3a164..73d0a0807138 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -244,6 +244,8 @@ extern int amdgpu_num_kcq;
>   #define AMDGPU_VCNFW_LOG_SIZE (32 * 1024)
>   extern int amdgpu_vcnfw_log;
>   
> +extern int amdgpu_force_sg_display;
> +
>   #define AMDGPU_VM_MAX_NUM_CTX			4096
>   #define AMDGPU_SG_THRESHOLD			(256*1024*1024)
>   #define AMDGPU_DEFAULT_GTT_SIZE_MB		3072ULL /* 3GB by default */
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 4cf2028b5235..c8975c2da853 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -943,6 +943,18 @@ MODULE_PARM_DESC(smu_pptable_id,
>   	"specify pptable id to be used (-1 = auto(default) value, 0 = use pptable from vbios, > 0 = soft pptable id)");
>   module_param_named(smu_pptable_id, amdgpu_smu_pptable_id, int, 0444);
>   
> +/**
> + * DOC: force_sg_display (int)
> + * Force display buffers into GTT (scatter/gather) memory for APUs.
> + * This is used to force GTT only for displays rather than displaying from
> + * either VRAM (carve out) or GTT.
> + *
> + * Defaults to 0, or disabled.
> + */
> +int amdgpu_force_sg_display;
> +MODULE_PARM_DESC(force_sg_display, "Force S/G display (0 = off (default), 1 = force display to use GTT) ");
> +module_param_named(force_sg_display, amdgpu_force_sg_display, int, 0444);
> +
>   /* These devices are not supported by amdgpu.
>    * They are supported by the mach64, r128, radeon drivers
>    */
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 981010de0a28..840190dd78e4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -1516,6 +1516,9 @@ uint32_t amdgpu_bo_get_preferred_domain(struct amdgpu_device *adev,
>   		if (adev->gmc.real_vram_size <= AMDGPU_SG_THRESHOLD)
>   			domain = AMDGPU_GEM_DOMAIN_GTT;
>   	}
> +	if ((domain == (AMDGPU_GEM_DOMAIN_VRAM | AMDGPU_GEM_DOMAIN_GTT)) &&
> +	    amdgpu_force_sg_display && adev->mode_info.gpu_vm_support)
> +		domain = AMDGPU_GEM_DOMAIN_GTT;
>   	return domain;
>   }
>   


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

end of thread, other threads:[~2023-02-01 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 17:51 [RFC PATCH] drm/amdgpu: add force_sg_display module parameter (v2) Alex Deucher
2023-01-27 17:51 ` [PATCH] drm/amd/display: add missing cyanskillfish check Alex Deucher
2023-02-01 16:06 ` [RFC PATCH] drm/amdgpu: add force_sg_display module parameter (v2) 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.