public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display
@ 2024-02-23 15:03 Thierry Reding
  2024-02-23 15:26 ` Javier Martinez Canillas
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Thierry Reding @ 2024-02-23 15:03 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jon Hunter, Javier Martinez Canillas, Thomas Zimmermann,
	Daniel Vetter, dri-devel, linux-tegra

From: Thierry Reding <treding@nvidia.com>

Tegra DRM doesn't support display on Tegra234 and later, so make sure
not to remove any existing framebuffers in that case.

v2: - add comments explaining how this situation can come about
    - clear DRIVER_MODESET and DRIVER_ATOMIC feature bits

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpu/drm/tegra/drm.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index b1e1a78e30c6..2e1cfe6f6d74 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -1220,9 +1220,26 @@ static int host1x_drm_probe(struct host1x_device *dev)
 
 	drm_mode_config_reset(drm);
 
-	err = drm_aperture_remove_framebuffers(&tegra_drm_driver);
-	if (err < 0)
-		goto hub;
+	/*
+	 * Only take over from a potential firmware framebuffer if any CRTCs
+	 * have been registered. This must not be a fatal error because there
+	 * are other accelerators that are exposed via this driver.
+	 *
+	 * Another case where this happens is on Tegra234 where the display
+	 * hardware is no longer part of the host1x complex, so this driver
+	 * will not expose any modesetting features.
+	 */
+	if (drm->mode_config.num_crtc > 0) {
+		err = drm_aperture_remove_framebuffers(&tegra_drm_driver);
+		if (err < 0)
+			goto hub;
+	} else {
+		/*
+		 * Indicate to userspace that this doesn't expose any display
+		 * capabilities.
+		 */
+		drm->driver_features &= ~(DRIVER_MODESET | DRIVER_ATOMIC);
+	}
 
 	err = drm_dev_register(drm, 0);
 	if (err < 0)
-- 
2.43.2


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

* Re: [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display
  2024-02-23 15:03 [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display Thierry Reding
@ 2024-02-23 15:26 ` Javier Martinez Canillas
  2024-02-26  8:24 ` Thomas Zimmermann
  2024-02-26 12:37 ` Robert Foss
  2 siblings, 0 replies; 7+ messages in thread
From: Javier Martinez Canillas @ 2024-02-23 15:26 UTC (permalink / raw)
  To: Thierry Reding, Thierry Reding
  Cc: Jon Hunter, Thomas Zimmermann, Daniel Vetter, dri-devel,
	linux-tegra

Thierry Reding <thierry.reding@gmail.com> writes:

Hello Thierry,

> From: Thierry Reding <treding@nvidia.com>
>
> Tegra DRM doesn't support display on Tegra234 and later, so make sure
> not to remove any existing framebuffers in that case.
>
> v2: - add comments explaining how this situation can come about
>     - clear DRIVER_MODESET and DRIVER_ATOMIC feature bits
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


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

* Re: [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display
  2024-02-23 15:03 [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display Thierry Reding
  2024-02-23 15:26 ` Javier Martinez Canillas
@ 2024-02-26  8:24 ` Thomas Zimmermann
  2024-02-26 11:36   ` Javier Martinez Canillas
  2024-02-26 12:37 ` Robert Foss
  2 siblings, 1 reply; 7+ messages in thread
From: Thomas Zimmermann @ 2024-02-26  8:24 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jon Hunter, Javier Martinez Canillas, Daniel Vetter, dri-devel,
	linux-tegra

Hi

Am 23.02.24 um 16:03 schrieb Thierry Reding:
> From: Thierry Reding <treding@nvidia.com>
>
> Tegra DRM doesn't support display on Tegra234 and later, so make sure
> not to remove any existing framebuffers in that case.
>
> v2: - add comments explaining how this situation can come about
>      - clear DRIVER_MODESET and DRIVER_ATOMIC feature bits
>
> Signed-off-by: Thierry Reding <treding@nvidia.com>

Makes sense as far as the aperture helpers are concerned.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regards
Thomas

> ---
>   drivers/gpu/drm/tegra/drm.c | 23 ++++++++++++++++++++---
>   1 file changed, 20 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index b1e1a78e30c6..2e1cfe6f6d74 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -1220,9 +1220,26 @@ static int host1x_drm_probe(struct host1x_device *dev)
>   
>   	drm_mode_config_reset(drm);
>   
> -	err = drm_aperture_remove_framebuffers(&tegra_drm_driver);
> -	if (err < 0)
> -		goto hub;
> +	/*
> +	 * Only take over from a potential firmware framebuffer if any CRTCs
> +	 * have been registered. This must not be a fatal error because there
> +	 * are other accelerators that are exposed via this driver.
> +	 *
> +	 * Another case where this happens is on Tegra234 where the display
> +	 * hardware is no longer part of the host1x complex, so this driver
> +	 * will not expose any modesetting features.
> +	 */
> +	if (drm->mode_config.num_crtc > 0) {
> +		err = drm_aperture_remove_framebuffers(&tegra_drm_driver);
> +		if (err < 0)
> +			goto hub;
> +	} else {
> +		/*
> +		 * Indicate to userspace that this doesn't expose any display
> +		 * capabilities.
> +		 */
> +		drm->driver_features &= ~(DRIVER_MODESET | DRIVER_ATOMIC);
> +	}
>   
>   	err = drm_dev_register(drm, 0);
>   	if (err < 0)

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)


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

* Re: [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display
  2024-02-26  8:24 ` Thomas Zimmermann
@ 2024-02-26 11:36   ` Javier Martinez Canillas
  2024-02-26 12:08     ` Robert Foss
  0 siblings, 1 reply; 7+ messages in thread
From: Javier Martinez Canillas @ 2024-02-26 11:36 UTC (permalink / raw)
  To: Thomas Zimmermann, Thierry Reding
  Cc: Jon Hunter, Daniel Vetter, dri-devel, linux-tegra

Thomas Zimmermann <tzimmermann@suse.de> writes:

> Hi
>
> Am 23.02.24 um 16:03 schrieb Thierry Reding:
>> From: Thierry Reding <treding@nvidia.com>
>>
>> Tegra DRM doesn't support display on Tegra234 and later, so make sure
>> not to remove any existing framebuffers in that case.
>>
>> v2: - add comments explaining how this situation can come about
>>      - clear DRIVER_MODESET and DRIVER_ATOMIC feature bits
>>
>> Signed-off-by: Thierry Reding <treding@nvidia.com>
>
> Makes sense as far as the aperture helpers are concerned.
>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
>

I believe this is drm-misc-fixes material. Since the tegra DRM will remove
simple{fb,drm} for Tegra234, even when the driver does not support display
on that platform, leaving the system with no display output at all.

Are you going to push this patch or is going to be done by Thierry?

> Best regards
> Thomas
>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


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

* Re: [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display
  2024-02-26 11:36   ` Javier Martinez Canillas
@ 2024-02-26 12:08     ` Robert Foss
  2024-02-26 14:04       ` Thierry Reding
  0 siblings, 1 reply; 7+ messages in thread
From: Robert Foss @ 2024-02-26 12:08 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Thomas Zimmermann, Thierry Reding, Jon Hunter, Daniel Vetter,
	dri-devel, linux-tegra

On Mon, Feb 26, 2024 at 12:36 PM Javier Martinez Canillas
<javierm@redhat.com> wrote:
>
> Thomas Zimmermann <tzimmermann@suse.de> writes:
>
> > Hi
> >
> > Am 23.02.24 um 16:03 schrieb Thierry Reding:
> >> From: Thierry Reding <treding@nvidia.com>
> >>
> >> Tegra DRM doesn't support display on Tegra234 and later, so make sure
> >> not to remove any existing framebuffers in that case.
> >>
> >> v2: - add comments explaining how this situation can come about
> >>      - clear DRIVER_MODESET and DRIVER_ATOMIC feature bits
> >>

Fixes: 6848c291a54f ("drm/aperture: Convert drivers to aperture interfaces")

Maybe this is more of a philosophical question, but either the
introduction of this hardware generation is where this regression was
introduced or this possibly this commit.

Either way, I'd like to get this into the drm-misc-fixes branch.

> >> Signed-off-by: Thierry Reding <treding@nvidia.com>
> >
> > Makes sense as far as the aperture helpers are concerned.
> >
> > Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> >
>
> I believe this is drm-misc-fixes material. Since the tegra DRM will remove
> simple{fb,drm} for Tegra234, even when the driver does not support display
> on that platform, leaving the system with no display output at all.
>
> Are you going to push this patch or is going to be done by Thierry?

I'm on it.

>
> > Best regards
> > Thomas
> >
>
> --
> Best regards,
>
> Javier Martinez Canillas
> Core Platforms
> Red Hat
>

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

* Re: [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display
  2024-02-23 15:03 [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display Thierry Reding
  2024-02-23 15:26 ` Javier Martinez Canillas
  2024-02-26  8:24 ` Thomas Zimmermann
@ 2024-02-26 12:37 ` Robert Foss
  2 siblings, 0 replies; 7+ messages in thread
From: Robert Foss @ 2024-02-26 12:37 UTC (permalink / raw)
  To: Thierry Reding
  Cc: linux-tegra, Jon Hunter, Javier Martinez Canillas,
	Thomas Zimmermann, dri-devel, Daniel Vetter

On Fri, 23 Feb 2024 16:03:33 +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> Tegra DRM doesn't support display on Tegra234 and later, so make sure
> not to remove any existing framebuffers in that case.
> 
> v2: - add comments explaining how this situation can come about
>     - clear DRIVER_MODESET and DRIVER_ATOMIC feature bits
> 
> [...]

Applied, thanks!

[1/1] drm/tegra: Remove existing framebuffer only if we support display
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=86bf8cfda6d2



Rob


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

* Re: [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display
  2024-02-26 12:08     ` Robert Foss
@ 2024-02-26 14:04       ` Thierry Reding
  0 siblings, 0 replies; 7+ messages in thread
From: Thierry Reding @ 2024-02-26 14:04 UTC (permalink / raw)
  To: Robert Foss, Javier Martinez Canillas
  Cc: Thomas Zimmermann, Jon Hunter, Daniel Vetter, dri-devel,
	linux-tegra

[-- Attachment #1: Type: text/plain, Size: 1344 bytes --]

On Mon Feb 26, 2024 at 1:08 PM CET, Robert Foss wrote:
> On Mon, Feb 26, 2024 at 12:36 PM Javier Martinez Canillas
> <javierm@redhat.com> wrote:
> >
> > Thomas Zimmermann <tzimmermann@suse.de> writes:
> >
> > > Hi
> > >
> > > Am 23.02.24 um 16:03 schrieb Thierry Reding:
> > >> From: Thierry Reding <treding@nvidia.com>
> > >>
> > >> Tegra DRM doesn't support display on Tegra234 and later, so make sure
> > >> not to remove any existing framebuffers in that case.
> > >>
> > >> v2: - add comments explaining how this situation can come about
> > >>      - clear DRIVER_MODESET and DRIVER_ATOMIC feature bits
> > >>
>
> Fixes: 6848c291a54f ("drm/aperture: Convert drivers to aperture interfaces")
>
> Maybe this is more of a philosophical question, but either the
> introduction of this hardware generation is where this regression was
> introduced or this possibly this commit.
>
> Either way, I'd like to get this into the drm-misc-fixes branch.

That commit looks about right. Technically Tegra234 support was
introduced in Linux 5.10 but the first platform where you we would've
seen this wasn't added until 5.17. The above commit is from 5.14, which
puts it about right in between there, so I think that's fine.

Backporting to anything before 5.14 would need to be manual and isn't
worth it.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2024-02-26 14:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-23 15:03 [PATCH v2] drm/tegra: Remove existing framebuffer only if we support display Thierry Reding
2024-02-23 15:26 ` Javier Martinez Canillas
2024-02-26  8:24 ` Thomas Zimmermann
2024-02-26 11:36   ` Javier Martinez Canillas
2024-02-26 12:08     ` Robert Foss
2024-02-26 14:04       ` Thierry Reding
2024-02-26 12:37 ` Robert Foss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox