Skip to contentSkip to conversation

drm: udl fixes

PATCH In review Reza Arbab 2 participants 6 messages Mar 22, 2019 – Mar 28, 2019

Subsystems (3)
lore
Share & tools
lore

Reza Arbab

author
#0 lore raw

cover drm: udl fixes

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(-)
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/2 drm/udl: Fix off-by-one error in udl_get_edid()

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")
---
 drivers/gpu/drm/udl/udl_connector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/udl/udl_connector.c +1 -1
index 66885c24590f..820543415a78 100644
@@ -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 {
Signature · 1 line
1.8.3.1
author
#2 lore raw

PATCH 2/2 drm/fb-helper: Do not scale depth down to 0

In reply to Reza Arbab

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")
---
 drivers/gpu/drm/drm_fb_helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_fb_helper.c +5 -1
index 0e9349ff2d16..a7028655a065 100644
@@ -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;
Signature · 1 line
1.8.3.1
#3 lore raw

Re: [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0

Quoted 11 lines · Reza Arbab

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

Quoted 5 lines

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")

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

author
#4 lore raw

Re: [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0

Quoted 3 lines · Linus Walleij

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.")

Signature · 1 line
Reza Arbab
author
#5 lore raw

Re: [PATCH 2/2] drm/fb-helper: Do not scale depth down to 0

Quoted 8 lines · Reza Arbab
Quoted 3 lines · Linus Walleij

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.")

Signature · 1 line
Reza Arbab