public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.
@ 2022-01-07 12:35 Ashish Arora
  2022-01-07 12:47 ` Jani Nikula
  0 siblings, 1 reply; 9+ messages in thread
From: Ashish Arora @ 2022-01-07 12:35 UTC (permalink / raw)
  To: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
	rodrigo.vivi@intel.com
  Cc: intel-gfx@lists.freedesktop.org, Linux Kernel Mailing List

From: Ashish Arora <ashisharora.linux@outlook.com>

On certain 4k panels, the BIOS framebuffer is larger than what panel
requires causing display corruption. Introduce a check for the same.

Signed-off-by: Ashish Arora <ashisharora.linux@outlook.com>
---
 drivers/gpu/drm/i915/display/intel_fbdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index adc3a81be..f9952e1f8 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -193,6 +193,17 @@ static int intelfb_create(struct drm_fb_helper *helper,
 	struct drm_i915_gem_object *obj;
 	int ret;
 
+	if (intel_fb &&
+	    (sizes->fb_width < intel_fb->base.width ||
+	     sizes->fb_height < intel_fb->base.height)) {
+		drm_dbg_kms(&dev_priv->drm,
+			    "BIOS fb too large (%dx%d), we require (%dx%d),"
+			    " releasing it\n",
+			    intel_fb->base.width, intel_fb->base.height,
+			    sizes->fb_width, sizes->fb_height);
+		drm_framebuffer_put(&intel_fb->base);
+		intel_fb = ifbdev->fb = NULL;
+	}
 	if (intel_fb &&
 	    (sizes->fb_width > intel_fb->base.width ||
 	     sizes->fb_height > intel_fb->base.height)) {
-- 
2.25.1



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

* Re: [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.
  2022-01-07 12:35 [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption Ashish Arora
@ 2022-01-07 12:47 ` Jani Nikula
  2022-01-07 13:59   ` Aditya Garg
  2022-01-07 14:02   ` Aditya Garg
  0 siblings, 2 replies; 9+ messages in thread
From: Jani Nikula @ 2022-01-07 12:47 UTC (permalink / raw)
  To: Ashish Arora, joonas.lahtinen@linux.intel.com,
	rodrigo.vivi@intel.com
  Cc: intel-gfx@lists.freedesktop.org, Linux Kernel Mailing List

On Fri, 07 Jan 2022, Ashish Arora <ashisharora.linux@outlook.com> wrote:
> From: Ashish Arora <ashisharora.linux@outlook.com>
>
> On certain 4k panels, the BIOS framebuffer is larger than what panel
> requires causing display corruption. Introduce a check for the same.

This is quite thin on details. Is there a bug report?

Moreover, if this is what we want, this should be combined with the
conditions that follow resulting in a "!=" check instead of separate "<"
and ">".

BR,
Jani.



>
> Signed-off-by: Ashish Arora <ashisharora.linux@outlook.com>
> ---
>  drivers/gpu/drm/i915/display/intel_fbdev.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index adc3a81be..f9952e1f8 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -193,6 +193,17 @@ static int intelfb_create(struct drm_fb_helper *helper,
>  	struct drm_i915_gem_object *obj;
>  	int ret;
>  
> +	if (intel_fb &&
> +	    (sizes->fb_width < intel_fb->base.width ||
> +	     sizes->fb_height < intel_fb->base.height)) {
> +		drm_dbg_kms(&dev_priv->drm,
> +			    "BIOS fb too large (%dx%d), we require (%dx%d),"
> +			    " releasing it\n",
> +			    intel_fb->base.width, intel_fb->base.height,
> +			    sizes->fb_width, sizes->fb_height);
> +		drm_framebuffer_put(&intel_fb->base);
> +		intel_fb = ifbdev->fb = NULL;
> +	}
>  	if (intel_fb &&
>  	    (sizes->fb_width > intel_fb->base.width ||
>  	     sizes->fb_height > intel_fb->base.height)) {

-- 
Jani Nikula, Intel Open Source Graphics Center

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

* Re: [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.
  2022-01-07 12:47 ` Jani Nikula
@ 2022-01-07 13:59   ` Aditya Garg
  2022-01-07 14:02   ` Aditya Garg
  1 sibling, 0 replies; 9+ messages in thread
From: Aditya Garg @ 2022-01-07 13:59 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx@lists.freedesktop.org, Linux Kernel Mailing List



> On 07-Jan-2022, at 6:17 PM, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> 
> On Fri, 07 Jan 2022, Ashish Arora <ashisharora.linux@outlook.com> wrote:
>> From: Ashish Arora <ashisharora.linux@outlook.com>
>> 
>> On certain 4k panels, the BIOS framebuffer is larger than what panel
>> requires causing display corruption. Introduce a check for the same.
> 
> This is quite thin on details. Is there a bug report?
No bug report, but an issue I am facing myself. This patch seems to fix it.
> 
> Moreover, if this is what we want, this should be combined with the
> conditions that follow resulting in a "!=" check instead of separate "<"
> and ">”.
Sending a version 2
> 
> BR,
> Jani.
> 
> 
> 
>> 
>> Signed-off-by: Ashish Arora <ashisharora.linux@outlook.com>
>> ---
>> drivers/gpu/drm/i915/display/intel_fbdev.c | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> index adc3a81be..f9952e1f8 100644
>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> @@ -193,6 +193,17 @@ static int intelfb_create(struct drm_fb_helper *helper,
>> 	struct drm_i915_gem_object *obj;
>> 	int ret;
>> 
>> +	if (intel_fb &&
>> +	    (sizes->fb_width < intel_fb->base.width ||
>> +	     sizes->fb_height < intel_fb->base.height)) {
>> +		drm_dbg_kms(&dev_priv->drm,
>> +			    "BIOS fb too large (%dx%d), we require (%dx%d),"
>> +			    " releasing it\n",
>> +			    intel_fb->base.width, intel_fb->base.height,
>> +			    sizes->fb_width, sizes->fb_height);
>> +		drm_framebuffer_put(&intel_fb->base);
>> +		intel_fb = ifbdev->fb = NULL;
>> +	}
>> 	if (intel_fb &&
>> 	    (sizes->fb_width > intel_fb->base.width ||
>> 	     sizes->fb_height > intel_fb->base.height)) {
> 
> -- 
> Jani Nikula, Intel Open Source Graphics Center


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

* Re: [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.
  2022-01-07 12:47 ` Jani Nikula
  2022-01-07 13:59   ` Aditya Garg
@ 2022-01-07 14:02   ` Aditya Garg
  1 sibling, 0 replies; 9+ messages in thread
From: Aditya Garg @ 2022-01-07 14:02 UTC (permalink / raw)
  To: Jani Nikula, Ashish Arora
  Cc: intel-gfx@lists.freedesktop.org, Linux Kernel Mailing List

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



On 07-Jan-2022, at 6:17 PM, Jani Nikula <jani.nikula@linux.intel.com<mailto:jani.nikula@linux.intel.com>> wrote:

On Fri, 07 Jan 2022, Ashish Arora <ashisharora.linux@outlook.com<mailto:ashisharora.linux@outlook.com>> wrote:
From: Ashish Arora <ashisharora.linux@outlook.com<mailto:ashisharora.linux@outlook.com>>

On certain 4k panels, the BIOS framebuffer is larger than what panel
requires causing display corruption. Introduce a check for the same.

This is quite thin on details. Is there a bug report?
I’d like to add on that T2 Macs also require this patch
Probably, Ashish better send a version 2

Moreover, if this is what we want, this should be combined with the
conditions that follow resulting in a "!=" check instead of separate "<"
and ">".

BR,
Jani.




Signed-off-by: Ashish Arora <ashisharora.linux@outlook.com<mailto:ashisharora.linux@outlook.com>>
---
drivers/gpu/drm/i915/display/intel_fbdev.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index adc3a81be..f9952e1f8 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -193,6 +193,17 @@ static int intelfb_create(struct drm_fb_helper *helper,
struct drm_i915_gem_object *obj;
int ret;

+ if (intel_fb &&
+     (sizes->fb_width < intel_fb->base.width ||
+      sizes->fb_height < intel_fb->base.height)) {
+ drm_dbg_kms(&dev_priv->drm,
+     "BIOS fb too large (%dx%d), we require (%dx%d),"
+     " releasing it\n",
+     intel_fb->base.width, intel_fb->base.height,
+     sizes->fb_width, sizes->fb_height);
+ drm_framebuffer_put(&intel_fb->base);
+ intel_fb = ifbdev->fb = NULL;
+ }
if (intel_fb &&
    (sizes->fb_width > intel_fb->base.width ||
     sizes->fb_height > intel_fb->base.height)) {

--
Jani Nikula, Intel Open Source Graphics Center


[-- Attachment #2: Type: text/html, Size: 15375 bytes --]

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

* Re: [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.
@ 2022-01-08  5:11 Orlando Chamberlain
  2022-01-08  8:55 ` Ashish Arora
  2022-01-08  9:59 ` Ashish Arora
  0 siblings, 2 replies; 9+ messages in thread
From: Orlando Chamberlain @ 2022-01-08  5:11 UTC (permalink / raw)
  To: jani.nikula; +Cc: Aun-Ali Zaidi, intel-gfx, linux-kernel, ashisharora.linux

I haven't observed "display corruption", but on my MacBookPro16,1 the bottom
and right edges of the TTY are not on the screen, so a few lines of text
cannot be seen.

This also occurs on the internal displays of all (as far as I know) other
2018-2020 Intel Macbooks when using the Intel GPU (The 15" and 16" ones
also have an AMDGPU, but this issue occurs when they have the Intel GPU
set as the boot gpu).

There's a similar patch that hasn't been sent upstream that people with these
Macbooks have been using:
https://github.com/aunali1/linux-mbp-arch/blob/master/7001-drm-i915-fbdev-Discard-BIOS-framebuffers-exceeding-h.patch

Cc: Aun-Ali Zaidi <admin@kodeit.net>

--
Thanks,
Orlando


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

* Re: [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.
  2022-01-08  5:11 Orlando Chamberlain
@ 2022-01-08  8:55 ` Ashish Arora
  2022-01-08  9:59 ` Ashish Arora
  1 sibling, 0 replies; 9+ messages in thread
From: Ashish Arora @ 2022-01-08  8:55 UTC (permalink / raw)
  To: Orlando Chamberlain, jani.nikula@linux.intel.com
  Cc: Aun-Ali Zaidi, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org

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

Hi Orlando

Thanks for informing that the Macs are also affected :). I've sne the v2 of the patch. You may try out if you want to.

Get Outlook for Android<https://aka.ms/AAb9ysg>
________________________________
From: Orlando Chamberlain <redecorating@protonmail.com>
Sent: Saturday, January 8, 2022 10:41:50 AM
To: jani.nikula@linux.intel.com <jani.nikula@linux.intel.com>
Cc: ashisharora.linux@outlook.com <ashisharora.linux@outlook.com>; intel-gfx@lists.freedesktop.org <intel-gfx@lists.freedesktop.org>; joonas.lahtinen@linux.intel.com <joonas.lahtinen@linux.intel.com>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; rodrigo.vivi@intel.com <rodrigo.vivi@intel.com>; Aun-Ali Zaidi <admin@kodeit.net>
Subject: Re: [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.

I haven't observed "display corruption", but on my MacBookPro16,1 the bottom
and right edges of the TTY are not on the screen, so a few lines of text
cannot be seen.

This also occurs on the internal displays of all (as far as I know) other
2018-2020 Intel Macbooks when using the Intel GPU (The 15" and 16" ones
also have an AMDGPU, but this issue occurs when they have the Intel GPU
set as the boot gpu).

There's a similar patch that hasn't been sent upstream that people with these
Macbooks have been using:
https://github.com/aunali1/linux-mbp-arch/blob/master/7001-drm-i915-fbdev-Discard-BIOS-framebuffers-exceeding-h.patch

Cc: Aun-Ali Zaidi <admin@kodeit.net>

--
Thanks,
Orlando


[-- Attachment #2: Type: text/html, Size: 2736 bytes --]

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

* Re: [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.
  2022-01-08  5:11 Orlando Chamberlain
  2022-01-08  8:55 ` Ashish Arora
@ 2022-01-08  9:59 ` Ashish Arora
  2022-01-08 10:26   ` Aun-Ali Zaidi
  1 sibling, 1 reply; 9+ messages in thread
From: Ashish Arora @ 2022-01-08  9:59 UTC (permalink / raw)
  To: Orlando Chamberlain
  Cc: Aun-Ali Zaidi, intel-gfx@lists.freedesktop.org,
	Linux Kernel Mailing List, Aditya Garg

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


I believe I forgot to add Aditya to the conversation. So, I am sending the patch as an attachment for those who want to test :)

[-- Attachment #2: 0001-drm.patch --]
[-- Type: application/octet-stream, Size: 1218 bytes --]

From: Ashish Arora <ashisharora.linux@outlook.com>

On certain 4k panels, the BIOS framebuffer is larger than what panel
requires causing display corruption. Introduce a check for the same.

Signed-off-by: Ashish Arora <ashisharora.linux@outlook.com>
---
 drivers/gpu/drm/i915/display/intel_fbdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index adc3a81be..0a64184df 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -194,10 +194,10 @@ static int intelfb_create(struct drm_fb_helper *helper,
 	int ret;
 
 	if (intel_fb &&
-	    (sizes->fb_width > intel_fb->base.width ||
-	     sizes->fb_height > intel_fb->base.height)) {
+	    (sizes->fb_width != intel_fb->base.width ||
+	     sizes->fb_height != intel_fb->base.height)) {
 		drm_dbg_kms(&dev_priv->drm,
-			    "BIOS fb too small (%dx%d), we require (%dx%d),"
+			    "BIOS fb not valid (%dx%d), we require (%dx%d),"
 			    " releasing it\n",
 			    intel_fb->base.width, intel_fb->base.height,
 			    sizes->fb_width, sizes->fb_height);
-- 
2.25.1


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

* Re: [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.
  2022-01-08  9:59 ` Ashish Arora
@ 2022-01-08 10:26   ` Aun-Ali Zaidi
  2022-01-08 10:43     ` Ashish Arora
  0 siblings, 1 reply; 9+ messages in thread
From: Aun-Ali Zaidi @ 2022-01-08 10:26 UTC (permalink / raw)
  To: Ashish Arora
  Cc: Orlando Chamberlain, intel-gfx@lists.freedesktop.org,
	Linux Kernel Mailing List, Aditya Garg

LGTM

—
Aun-Ali Zaidi

> On Jan 8, 2022, at 3:59 AM, Ashish Arora <ashisharora.linux@outlook.com> wrote:
> 
> 
> I believe I forgot to add Aditya to the conversation. So, I am sending the patch as an attachment for those who want to test :)<0001-drm.patch>


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

* Re: [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption.
  2022-01-08 10:26   ` Aun-Ali Zaidi
@ 2022-01-08 10:43     ` Ashish Arora
  0 siblings, 0 replies; 9+ messages in thread
From: Ashish Arora @ 2022-01-08 10:43 UTC (permalink / raw)
  To: Aun-Ali Zaidi
  Cc: Orlando Chamberlain, intel-gfx@lists.freedesktop.org,
	Linux Kernel Mailing List, Aditya Garg

May I add your reviewed-by Aun-Ali Zaidi ?

> On 08-Jan-2022, at 3:56 PM, Aun-Ali Zaidi <admin@kodeit.net> wrote:
> 
> LGTM
> 
> —
> Aun-Ali Zaidi
> 
>> On Jan 8, 2022, at 3:59 AM, Ashish Arora <ashisharora.linux@outlook.com> wrote:
>> 
>> 
>> I believe I forgot to add Aditya to the conversation. So, I am sending the patch as an attachment for those who want to test :)<0001-drm.patch>
> 


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

end of thread, other threads:[~2022-01-10 13:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-07 12:35 [Intel-gfx] [PATCH] drm/i915: Discard large BIOS framebuffers causing display corruption Ashish Arora
2022-01-07 12:47 ` Jani Nikula
2022-01-07 13:59   ` Aditya Garg
2022-01-07 14:02   ` Aditya Garg
  -- strict thread matches above, loose matches on Subject: below --
2022-01-08  5:11 Orlando Chamberlain
2022-01-08  8:55 ` Ashish Arora
2022-01-08  9:59 ` Ashish Arora
2022-01-08 10:26   ` Aun-Ali Zaidi
2022-01-08 10:43     ` Ashish Arora

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