diff mbox series

[v4,68/80] drm/nouveau: Run DRM default client setup

Message ID 20240909113633.595465-69-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 Sept. 9, 2024, 11:31 a.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 nouveau 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: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Danilo Krummrich <dakr@redhat.com>
Acked-by: Danilo Krummrich <dakr@kernel.org>
---
 drivers/gpu/drm/nouveau/nouveau_drm.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Lyude Paul Sept. 12, 2024, 6:04 p.m. UTC | #1
Reviewed-by: Lyude Paul <lyude@redhat.com>

I assume you can push this to drm-misc-next yourself?

On Mon, 2024-09-09 at 13:31 +0200, 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 nouveau 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: Karol Herbst <kherbst@redhat.com>
> Cc: Lyude Paul <lyude@redhat.com>
> Cc: Danilo Krummrich <dakr@redhat.com>
> Acked-by: Danilo Krummrich <dakr@kernel.org>
> ---
>  drivers/gpu/drm/nouveau/nouveau_drm.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index 4a9a9b9c3935..628c47a60de5 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -31,6 +31,7 @@
>  #include <linux/dynamic_debug.h>
>  
>  #include <drm/drm_aperture.h>
> +#include <drm/drm_client_setup.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_fbdev_ttm.h>
>  #include <drm/drm_gem_ttm_helper.h>
> @@ -836,6 +837,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
>  {
>  	struct nvkm_device *device;
>  	struct nouveau_drm *drm;
> +	const struct drm_format_info *format;
>  	int ret;
>  
>  	if (vga_switcheroo_client_probe_defer(pdev))
> @@ -873,9 +875,11 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
>  		goto fail_pci;
>  
>  	if (drm->client.device.info.ram_size <= 32 * 1024 * 1024)
> -		drm_fbdev_ttm_setup(drm->dev, 8);
> +		format = drm_format_info(DRM_FORMAT_C8);
>  	else
> -		drm_fbdev_ttm_setup(drm->dev, 32);
> +		format = NULL;
> +
> +	drm_client_setup(drm->dev, format);
>  
>  	quirk_broken_nv_runpm(pdev);
>  	return 0;
> @@ -1317,6 +1321,8 @@ driver_stub = {
>  	.dumb_create = nouveau_display_dumb_create,
>  	.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
>  
> +	DRM_FBDEV_TTM_DRIVER_OPS,
> +
>  	.name = DRIVER_NAME,
>  	.desc = DRIVER_DESC,
>  #ifdef GIT_REVISION
Thomas Zimmermann Sept. 13, 2024, 6:23 a.m. UTC | #2
Hi

Am 12.09.24 um 20:04 schrieb Lyude Paul:
> Reviewed-by: Lyude Paul <lyude@redhat.com>

Thanks a lot.

>
> I assume you can push this to drm-misc-next yourself?

I think so. :)

Best regards
Thomas

>
> On Mon, 2024-09-09 at 13:31 +0200, 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 nouveau 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: Karol Herbst <kherbst@redhat.com>
>> Cc: Lyude Paul <lyude@redhat.com>
>> Cc: Danilo Krummrich <dakr@redhat.com>
>> Acked-by: Danilo Krummrich <dakr@kernel.org>
>> ---
>>   drivers/gpu/drm/nouveau/nouveau_drm.c | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
>> index 4a9a9b9c3935..628c47a60de5 100644
>> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
>> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
>> @@ -31,6 +31,7 @@
>>   #include <linux/dynamic_debug.h>
>>   
>>   #include <drm/drm_aperture.h>
>> +#include <drm/drm_client_setup.h>
>>   #include <drm/drm_drv.h>
>>   #include <drm/drm_fbdev_ttm.h>
>>   #include <drm/drm_gem_ttm_helper.h>
>> @@ -836,6 +837,7 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
>>   {
>>   	struct nvkm_device *device;
>>   	struct nouveau_drm *drm;
>> +	const struct drm_format_info *format;
>>   	int ret;
>>   
>>   	if (vga_switcheroo_client_probe_defer(pdev))
>> @@ -873,9 +875,11 @@ static int nouveau_drm_probe(struct pci_dev *pdev,
>>   		goto fail_pci;
>>   
>>   	if (drm->client.device.info.ram_size <= 32 * 1024 * 1024)
>> -		drm_fbdev_ttm_setup(drm->dev, 8);
>> +		format = drm_format_info(DRM_FORMAT_C8);
>>   	else
>> -		drm_fbdev_ttm_setup(drm->dev, 32);
>> +		format = NULL;
>> +
>> +	drm_client_setup(drm->dev, format);
>>   
>>   	quirk_broken_nv_runpm(pdev);
>>   	return 0;
>> @@ -1317,6 +1321,8 @@ driver_stub = {
>>   	.dumb_create = nouveau_display_dumb_create,
>>   	.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
>>   
>> +	DRM_FBDEV_TTM_DRIVER_OPS,
>> +
>>   	.name = DRIVER_NAME,
>>   	.desc = DRIVER_DESC,
>>   #ifdef GIT_REVISION
diff mbox series

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 4a9a9b9c3935..628c47a60de5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -31,6 +31,7 @@ 
 #include <linux/dynamic_debug.h>
 
 #include <drm/drm_aperture.h>
+#include <drm/drm_client_setup.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fbdev_ttm.h>
 #include <drm/drm_gem_ttm_helper.h>
@@ -836,6 +837,7 @@  static int nouveau_drm_probe(struct pci_dev *pdev,
 {
 	struct nvkm_device *device;
 	struct nouveau_drm *drm;
+	const struct drm_format_info *format;
 	int ret;
 
 	if (vga_switcheroo_client_probe_defer(pdev))
@@ -873,9 +875,11 @@  static int nouveau_drm_probe(struct pci_dev *pdev,
 		goto fail_pci;
 
 	if (drm->client.device.info.ram_size <= 32 * 1024 * 1024)
-		drm_fbdev_ttm_setup(drm->dev, 8);
+		format = drm_format_info(DRM_FORMAT_C8);
 	else
-		drm_fbdev_ttm_setup(drm->dev, 32);
+		format = NULL;
+
+	drm_client_setup(drm->dev, format);
 
 	quirk_broken_nv_runpm(pdev);
 	return 0;
@@ -1317,6 +1321,8 @@  driver_stub = {
 	.dumb_create = nouveau_display_dumb_create,
 	.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
 
+	DRM_FBDEV_TTM_DRIVER_OPS,
+
 	.name = DRIVER_NAME,
 	.desc = DRIVER_DESC,
 #ifdef GIT_REVISION