diff mbox series

[v2,65/86] drm/amdgpu: Run DRM default client setup

Message ID 20240821130348.73038-66-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm: Provide client setup helper and convert drivers | expand

Commit Message

Thomas Zimmermann Aug. 21, 2024, 1 p.m. UTC
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

The amdgpu driver specifies a preferred color mode depending on
the available video memory, with a default of 32. Adapt this for
the new client interface.

v2:
- style changes

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Xinhui Pan <Xinhui.Pan@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Hamza Mahfooz Aug. 22, 2024, 2:03 p.m. UTC | #1
On 8/21/24 09:00, Thomas Zimmermann wrote:
> Call drm_client_setup() to run the kernel's default client setup
> for DRM. Set fbdev_probe in struct drm_driver, so that the client
> setup can start the common fbdev client.
> 
> The amdgpu driver specifies a preferred color mode depending on
> the available video memory, with a default of 32. Adapt this for
> the new client interface.
> 
> v2:
> - style changes
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: Xinhui Pan <Xinhui.Pan@amd.com>

Tested-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Acked-by: Hamza Mahfooz <hamza.mahfooz@amd.com>

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 5dd39e6c6223..849d59e2bca7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -23,6 +23,7 @@
>    */
>   
>   #include <drm/amdgpu_drm.h>
> +#include <drm/drm_client_setup.h>
>   #include <drm/drm_drv.h>
>   #include <drm/drm_fbdev_ttm.h>
>   #include <drm/drm_gem.h>
> @@ -2341,11 +2342,15 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>   	 */
>   	if (adev->mode_info.mode_config_initialized &&
>   	    !list_empty(&adev_to_drm(adev)->mode_config.connector_list)) {
> +		const struct drm_format_info *format;
> +
>   		/* select 8 bpp console on low vram cards */
>   		if (adev->gmc.real_vram_size <= (32*1024*1024))
> -			drm_fbdev_ttm_setup(adev_to_drm(adev), 8);
> +			format = drm_format_info(DRM_FORMAT_C8);
>   		else
> -			drm_fbdev_ttm_setup(adev_to_drm(adev), 32);
> +			format = NULL;
> +
> +		drm_client_setup(adev_to_drm(adev), format);
>   	}
>   
>   	ret = amdgpu_debugfs_init(adev);
> @@ -2957,6 +2962,7 @@ static const struct drm_driver amdgpu_kms_driver = {
>   	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>   	.dumb_create = amdgpu_mode_dumb_create,
>   	.dumb_map_offset = amdgpu_mode_dumb_mmap,
> +	DRM_FBDEV_TTM_DRIVER_OPS,
>   	.fops = &amdgpu_driver_kms_fops,
>   	.release = &amdgpu_driver_release_kms,
>   #ifdef CONFIG_PROC_FS
> @@ -2983,6 +2989,7 @@ const struct drm_driver amdgpu_partition_driver = {
>   	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>   	.dumb_create = amdgpu_mode_dumb_create,
>   	.dumb_map_offset = amdgpu_mode_dumb_mmap,
> +	DRM_FBDEV_TTM_DRIVER_OPS,
>   	.fops = &amdgpu_driver_kms_fops,
>   	.release = &amdgpu_driver_release_kms,
>
Alex Deucher Aug. 22, 2024, 2:32 p.m. UTC | #2
On Wed, Aug 21, 2024 at 9:06 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Call drm_client_setup() to run the kernel's default client setup
> for DRM. Set fbdev_probe in struct drm_driver, so that the client
> setup can start the common fbdev client.
>
> The amdgpu driver specifies a preferred color mode depending on
> the available video memory, with a default of 32. Adapt this for
> the new client interface.
>
> v2:
> - style changes
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: Xinhui Pan <Xinhui.Pan@amd.com>

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

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 5dd39e6c6223..849d59e2bca7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -23,6 +23,7 @@
>   */
>
>  #include <drm/amdgpu_drm.h>
> +#include <drm/drm_client_setup.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_fbdev_ttm.h>
>  #include <drm/drm_gem.h>
> @@ -2341,11 +2342,15 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
>          */
>         if (adev->mode_info.mode_config_initialized &&
>             !list_empty(&adev_to_drm(adev)->mode_config.connector_list)) {
> +               const struct drm_format_info *format;
> +
>                 /* select 8 bpp console on low vram cards */
>                 if (adev->gmc.real_vram_size <= (32*1024*1024))
> -                       drm_fbdev_ttm_setup(adev_to_drm(adev), 8);
> +                       format = drm_format_info(DRM_FORMAT_C8);
>                 else
> -                       drm_fbdev_ttm_setup(adev_to_drm(adev), 32);
> +                       format = NULL;
> +
> +               drm_client_setup(adev_to_drm(adev), format);
>         }
>
>         ret = amdgpu_debugfs_init(adev);
> @@ -2957,6 +2962,7 @@ static const struct drm_driver amdgpu_kms_driver = {
>         .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>         .dumb_create = amdgpu_mode_dumb_create,
>         .dumb_map_offset = amdgpu_mode_dumb_mmap,
> +       DRM_FBDEV_TTM_DRIVER_OPS,
>         .fops = &amdgpu_driver_kms_fops,
>         .release = &amdgpu_driver_release_kms,
>  #ifdef CONFIG_PROC_FS
> @@ -2983,6 +2989,7 @@ const struct drm_driver amdgpu_partition_driver = {
>         .num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
>         .dumb_create = amdgpu_mode_dumb_create,
>         .dumb_map_offset = amdgpu_mode_dumb_mmap,
> +       DRM_FBDEV_TTM_DRIVER_OPS,
>         .fops = &amdgpu_driver_kms_fops,
>         .release = &amdgpu_driver_release_kms,
>
> --
> 2.46.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 5dd39e6c6223..849d59e2bca7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -23,6 +23,7 @@ 
  */
 
 #include <drm/amdgpu_drm.h>
+#include <drm/drm_client_setup.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_gem.h>
@@ -2341,11 +2342,15 @@  static int amdgpu_pci_probe(struct pci_dev *pdev,
 	 */
 	if (adev->mode_info.mode_config_initialized &&
 	    !list_empty(&adev_to_drm(adev)->mode_config.connector_list)) {
+		const struct drm_format_info *format;
+
 		/* select 8 bpp console on low vram cards */
 		if (adev->gmc.real_vram_size <= (32*1024*1024))
-			drm_fbdev_ttm_setup(adev_to_drm(adev), 8);
+			format = drm_format_info(DRM_FORMAT_C8);
 		else
-			drm_fbdev_ttm_setup(adev_to_drm(adev), 32);
+			format = NULL;
+
+		drm_client_setup(adev_to_drm(adev), format);
 	}
 
 	ret = amdgpu_debugfs_init(adev);
@@ -2957,6 +2962,7 @@  static const struct drm_driver amdgpu_kms_driver = {
 	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.dumb_create = amdgpu_mode_dumb_create,
 	.dumb_map_offset = amdgpu_mode_dumb_mmap,
+	DRM_FBDEV_TTM_DRIVER_OPS,
 	.fops = &amdgpu_driver_kms_fops,
 	.release = &amdgpu_driver_release_kms,
 #ifdef CONFIG_PROC_FS
@@ -2983,6 +2989,7 @@  const struct drm_driver amdgpu_partition_driver = {
 	.num_ioctls = ARRAY_SIZE(amdgpu_ioctls_kms),
 	.dumb_create = amdgpu_mode_dumb_create,
 	.dumb_map_offset = amdgpu_mode_dumb_mmap,
+	DRM_FBDEV_TTM_DRIVER_OPS,
 	.fops = &amdgpu_driver_kms_fops,
 	.release = &amdgpu_driver_release_kms,