linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] drm: udl fixes
@ 2019-03-22 20:56 Reza Arbab
  2019-03-22 20:56 ` [PATCH 1/2] drm/udl: Fix off-by-one error in udl_get_edid() Reza Arbab
  2019-03-22 20:56 ` [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0 Reza Arbab
  0 siblings, 2 replies; 6+ messages in thread
From: Reza Arbab @ 2019-03-22 20:56 UTC (permalink / raw)
  To: Dave Airlie, Sean Paul, David Airlie, Daniel Vetter,
	Robert Tarasov, Linus Walleij, dri-devel, linux-kernel
  Cc: wzabolot, Pavel Machek, Alex Deucher, Noralf Trønnes,
	Ville Syrjälä

These fixes were needed to bring my udl devices to life on v5.1-rc1.

Reza Arbab (2):
  drm/udl: Fix off-by-one error in udl_get_edid()
  drm/fb-helper: Do not scale depth down to 0

 drivers/gpu/drm/drm_fb_helper.c     | 6 +++++-
 drivers/gpu/drm/udl/udl_connector.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
1.8.3.1


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

* [PATCH 1/2] drm/udl: Fix off-by-one error in udl_get_edid()
  2019-03-22 20:56 [PATCH 0/2] drm: udl fixes Reza Arbab
@ 2019-03-22 20:56 ` Reza Arbab
  2019-03-22 20:56 ` [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0 Reza Arbab
  1 sibling, 0 replies; 6+ messages in thread
From: Reza Arbab @ 2019-03-22 20:56 UTC (permalink / raw)
  To: Dave Airlie, Sean Paul, David Airlie, Daniel Vetter,
	Robert Tarasov, Linus Walleij, dri-devel, linux-kernel
  Cc: wzabolot, Pavel Machek, Alex Deucher, Noralf Trønnes,
	Ville Syrjälä

The loop which reads EDID extension blocks is off by one. Fix it.

Fixes: 75c65ee20ade ("drm/udl: Reading all edid blocks in DRM/UDL driver")
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
---
 drivers/gpu/drm/udl/udl_connector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index 66885c24590f..820543415a78 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -71,7 +71,7 @@ static bool udl_get_edid(struct udl_device *udl, u8 **result_buff,
 			memcpy(buff_ptr, block_buff, EDID_LENGTH);
 			kfree(block_buff);
 			buff_ptr += EDID_LENGTH;
-			for (i = 1; i < extensions; ++i) {
+			for (i = 1; i <= extensions; ++i) {
 				if (udl_get_edid_block(udl, i, buff_ptr)) {
 					buff_ptr += EDID_LENGTH;
 				} else {
-- 
1.8.3.1


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

* [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0
  2019-03-22 20:56 [PATCH 0/2] drm: udl fixes Reza Arbab
  2019-03-22 20:56 ` [PATCH 1/2] drm/udl: Fix off-by-one error in udl_get_edid() Reza Arbab
@ 2019-03-22 20:56 ` Reza Arbab
  2019-03-28 16:33   ` Linus Walleij
  1 sibling, 1 reply; 6+ messages in thread
From: Reza Arbab @ 2019-03-22 20:56 UTC (permalink / raw)
  To: Dave Airlie, Sean Paul, David Airlie, Daniel Vetter,
	Robert Tarasov, Linus Walleij, dri-devel, linux-kernel
  Cc: wzabolot, Pavel Machek, Alex Deucher, Noralf Trønnes,
	Ville Syrjälä

If the scaling loop in drm_fb_helper_single_fb_probe() only finds
supported depths greater than what it's looking for, it will set
sizes.surface_depth = 0. This broke my udl device:

[drm] test CRTC 0 primary plane
udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: test CRTC 0 format 0, depth=24
udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: 24 > 16, skipping
udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: test CRTC 0 format 1, depth=32
udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: 32 > 16, skipping
[drm] requested bpp 16, scaled depth down to 0

Instead of setting zero depth, print that scaling was not possible and
do nothing.

Fixes: f4bd542bcaee ("drm/fb-helper: Scale back depth to supported maximum")
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 0e9349ff2d16..a7028655a065 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1963,7 +1963,11 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
 				best_depth = fmt->depth;
 		}
 	}
-	if (sizes.surface_depth != best_depth) {
+
+	if (!best_depth) {
+		DRM_INFO("Could not scale depth to requested bpp %d",
+			 sizes.surface_bpp);
+	} else if (sizes.surface_depth != best_depth) {
 		DRM_INFO("requested bpp %d, scaled depth down to %d",
 			 sizes.surface_bpp, best_depth);
 		sizes.surface_depth = best_depth;
-- 
1.8.3.1


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

* Re: [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0
  2019-03-22 20:56 ` [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0 Reza Arbab
@ 2019-03-28 16:33   ` Linus Walleij
  2019-03-28 16:52     ` Reza Arbab
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2019-03-28 16:33 UTC (permalink / raw)
  To: Reza Arbab
  Cc: Dave Airlie, Sean Paul, David Airlie, Daniel Vetter,
	Robert Tarasov, open list:DRM PANEL DRIVERS, linux-kernel,
	wzabolot, Pavel Machek, Alex Deucher, Noralf Trønnes,
	Ville Syrjälä

On Fri, Mar 22, 2019 at 9:56 PM Reza Arbab <arbab@linux.ibm.com> wrote:

> If the scaling loop in drm_fb_helper_single_fb_probe() only finds
> supported depths greater than what it's looking for, it will set
> sizes.surface_depth = 0. This broke my udl device:
>
> [drm] test CRTC 0 primary plane
> udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: test CRTC 0 format 0, depth=24
> udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: 24 > 16, skipping
> udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: test CRTC 0 format 1, depth=32
> udl 3-9.1:1.0: drm_fb_helper_single_fb_probe: 32 > 16, skipping
> [drm] requested bpp 16, scaled depth down to 0
>
> Instead of setting zero depth, print that scaling was not possible and
> do nothing.
>
> Fixes: f4bd542bcaee ("drm/fb-helper: Scale back depth to supported maximum")
> Signed-off-by: Reza Arbab <arbab@linux.ibm.com>

This makes perfect sense, but Dave Airlie already sent a similar
patch some two weeks ago, I wonder what happened with it?
Subject "avoid setting 0 depth".

Yours,
Linus Walleij

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

* Re: [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0
  2019-03-28 16:33   ` Linus Walleij
@ 2019-03-28 16:52     ` Reza Arbab
  2019-03-28 17:05       ` Reza Arbab
  0 siblings, 1 reply; 6+ messages in thread
From: Reza Arbab @ 2019-03-28 16:52 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Dave Airlie, Sean Paul, David Airlie, Daniel Vetter,
	Robert Tarasov, open list:DRM PANEL DRIVERS, linux-kernel,
	wzabolot, Pavel Machek, Alex Deucher, Noralf Trønnes,
	Ville Syrjälä

On Thu, Mar 28, 2019 at 05:33:31PM +0100, Linus Walleij wrote:
>This makes perfect sense, but Dave Airlie already sent a similar
>patch some two weeks ago, I wonder what happened with it?
>Subject "avoid setting 0 depth".

Argh, that he did! I'm not subscribed to dri-devel so I didn't see that.

Did this get lost? The other patch from that series has been applied; 
8f3b487685b2 ("drm/udl: use drm_gem_object_put_unlocked.")

-- 
Reza Arbab


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

* Re: [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0
  2019-03-28 16:52     ` Reza Arbab
@ 2019-03-28 17:05       ` Reza Arbab
  0 siblings, 0 replies; 6+ messages in thread
From: Reza Arbab @ 2019-03-28 17:05 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Dave Airlie, Sean Paul, David Airlie, Daniel Vetter,
	Robert Tarasov, open list:DRM PANEL DRIVERS, linux-kernel,
	wzabolot, Pavel Machek, Alex Deucher, Noralf Trønnes,
	Ville Syrjälä

On Thu, Mar 28, 2019 at 11:52:30AM -0500, Reza Arbab wrote:
>On Thu, Mar 28, 2019 at 05:33:31PM +0100, Linus Walleij wrote:
>>This makes perfect sense, but Dave Airlie already sent a similar
>>patch some two weeks ago, I wonder what happened with it?
>>Subject "avoid setting 0 depth".
>
>Argh, that he did! I'm not subscribed to dri-devel so I didn't see that.
>
>Did this get lost? The other patch from that series has been applied; 
>8f3b487685b2 ("drm/udl: use drm_gem_object_put_unlocked.")

Never mind. It's in the drm-fixes tree. Looks like both of my patches 
got beaten to the punch there:

a51143001d9e ("drm/udl: Refactor edid retrieving in UDL driver (v2)")
b6a36e5ddf84 ("drm/fb: avoid setting 0 depth.")

-- 
Reza Arbab


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

end of thread, other threads:[~2019-03-28 17:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 20:56 [PATCH 0/2] drm: udl fixes Reza Arbab
2019-03-22 20:56 ` [PATCH 1/2] drm/udl: Fix off-by-one error in udl_get_edid() Reza Arbab
2019-03-22 20:56 ` [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0 Reza Arbab
2019-03-28 16:33   ` Linus Walleij
2019-03-28 16:52     ` Reza Arbab
2019-03-28 17:05       ` Reza Arbab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).