diff mbox

unreadable external HDMI display in recent kernels, work around

Message ID 20161209182828.GA23583@tdkt.org (mailing list archive)
State New, archived
Headers show

Commit Message

Erik Jacobson Dec. 9, 2016, 6:28 p.m. UTC
I hope this email finds you well. I apologize as I'm not a graphics kernel
developer. I hope we don't discover that this email is a complete newbie
email.

Problem: External HDMI display is unreadable. You can make out edges of
windows and other stuff. Other than that it looks like a garbled mess of
colors.

Work around: See below and attached proof of concept patch.


HW: - IdeaPad y510P (i7 notebook)
    - Intel and NVIDIA graphics (Intel primary)
        -> 00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
        -> 01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 755M] (rev a1)
    - Monitor: External HDMI Acer H243H


SW - Problem Started in a Fedora23 update (Fedora23 GA was OK.
       -> I would guess it happened with the switch to the 4.8 series
          Good: kernel-4.2.3-300.fc23, bad: kernel-4.8.10-100.fc23
   - Fedora 25 has the problem
   - OpenSUSE Leap 42.2 has the problem
   - drm-intel drm-intel-nightly branch kernel has the problem
   - Latest kernel.org versions have the problem


Research and Work Around

Besides building several different kernels to see where the problems
were, I booted the kernel with the drm.debug=14 option and looked carefully at
the output. I found these interesting lines:


Working OLD Fedora23 GA kernel kernel-4.2.3-300.fc23:

[    2.895638] [drm:intel_modeset_stage_output_state] [CONNECTOR:42:HDMI-A-1] to [CRTC:25]
[    2.895639] [drm:connected_sink_compute_bpp] [CONNECTOR:42:HDMI-A-1] checking for sink bpp constrains
[    2.895640] [drm:connected_sink_compute_bpp] clamping display bpp (was 36) to EDID reported max of 30
[    2.895642] [drm:intel_hdmi_compute_config] picking bpc to 8 for HDMI output
[    2.895642] [drm:intel_hdmi_compute_config] forcing pipe bpc to 24 for HDMI
[    2.895643] [drm:intel_crtc_compute_config] intel_crtc = ffff880360b76000 drm_state (pipe_config->base.state) = ffff88035c7d5ae0
[    2.895643] [drm:intel_modeset_pipe_config] plane bpp: 36, pipe bpp: 24, dithering: 0
[    2.895644] [drm:intel_dump_pipe_config] [CRTC:25][modeset] config ffff88035d3bd000 for pipe B
[    2.895644] [drm:intel_dump_pipe_config] cpu_transcoder: B
[    2.895644] [drm:intel_dump_pipe_config] pipe bpp: 24, dithering: 0


Broken new Fedora25 kernel 4.8.11-300.fc25

[    2.625766] [drm:connected_sink_compute_bpp] [CONNECTOR:47:HDMI-A-1] checking for sink bpp constrains
[    2.625767] [drm:connected_sink_compute_bpp] clamping display bpp (was 36) to EDID reported max of 30
[    2.625769] [drm:intel_hdmi_compute_config] picking bpc to 12 for HDMI output
[    2.625769] [drm:intel_hdmi_compute_config] forcing pipe bpc to 36 for HDMI
[    2.625770] [drm:intel_modeset_pipe_config] hw max bpp: 36, pipe bpp: 36, dithering: 0
[    2.625770] [drm:intel_dump_pipe_config] [CRTC:30:pipe B][modeset] config ffffa2f99ba00800 for pipe B



When I saw that the 'bpc' that was decided on differed, I used this information
and made a patch to the drm i915 driver in the kernel. It is obviously not
a solution but a proof of concept. The patch changes the
intel_hdmi_compute_config() function in intel_hdmi.c to always pick
bpc 8 and never try to use 12.

I have attached the proof of concept patch to this email.

Once I showed the proof of concept worked, I rebuilt the Fedora25
4.8.11-300.fc25 rpms with the patch and installed them. It is working
great.


I am not an expert in this area. However, if the problem is some sort of
issue that my HDMI monitor is mis-reporting, one idea would be to expose
yet another module parameter option to force the bpc value. Then people
with the offending hw combination like me could use normal kernels and
simply add the option. I do not know if that is a reasonable solution.

I did try to explore some EDID options (I guess you can supply your own
in /usr/lib/firmware and the initrd) but it seemed like it wasn't likely
to solve this specific issue. Please tell me if that was incorrect!

I'm hoping someone will help me out by saying I missed an obvious easy
solution. Then I will crawl back in to my cave, happy :)


Best wishes everybody,

Erik
From zz Fri Dec  9 00:01:20 CST 2016
From: Erik Jacobson <erikj@tdkt.org>
Date: Fri Dec  9 00:01:59 CST 2016
Subject: Fix Erik's i915 acer external hdmi monitor hdmi

Fix my hdmi monitor

Signed-off-by: Erik Jacobson <erikj@tdkt.org>
diff mbox

Patch

diff -Narup kernel-4.8.fc25-ORIG/linux-4.8.11-300.fc25.x86_64/drivers/gpu/drm/i915/intel_hdmi.c kernel-4.8.fc25/linux-4.8.11-300.fc25.x86_64/drivers/gpu/drm/i915/intel_hdmi.c
--- a/drivers/gpu/drm/i915/intel_hdmi.c	2016-12-08 23:49:38.385708682 -0600
+++ b/drivers/gpu/drm/i915/intel_hdmi.c	2016-12-08 23:53:00.677599745 -0600
@@ -1327,20 +1327,27 @@  bool intel_hdmi_compute_config(struct in
 	 * outputs. We also need to check that the higher clock still fits
 	 * within limits.
 	 */
-	if (pipe_config->pipe_bpp > 8*3 && pipe_config->has_hdmi_sink &&
-	    hdmi_port_clock_valid(intel_hdmi, clock_12bpc, true) == MODE_OK &&
-	    hdmi_12bpc_possible(pipe_config)) {
-		DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
-		desired_bpp = 12*3;
+/* erikj forcing 8 */
+//	if (pipe_config->pipe_bpp > 8*3 && pipe_config->has_hdmi_sink &&
+//	    hdmi_port_clock_valid(intel_hdmi, clock_12bpc, true) == MODE_OK &&
+//	    hdmi_12bpc_possible(pipe_config)) {
+//		DRM_DEBUG_KMS("picking bpc to 12 for HDMI output\n");
+//		desired_bpp = 12*3;
+//
+//		/* Need to adjust the port link by 1.5x for 12bpc. */
+//		pipe_config->port_clock = clock_12bpc;
+//	} else {
+//		DRM_DEBUG_KMS("picking bpc to 8 for HDMI output\n");
+//		desired_bpp = 8*3;
+//
+//		pipe_config->port_clock = clock_8bpc;
+//	}
+/* erikj here is the force */
+	DRM_DEBUG_KMS("erikj force-picking bpc to 8 for HDMI output\n");
+	desired_bpp = 8*3;
 
-		/* Need to adjust the port link by 1.5x for 12bpc. */
-		pipe_config->port_clock = clock_12bpc;
-	} else {
-		DRM_DEBUG_KMS("picking bpc to 8 for HDMI output\n");
-		desired_bpp = 8*3;
-
-		pipe_config->port_clock = clock_8bpc;
-	}
+	pipe_config->port_clock = clock_8bpc;
+/* end erikj */
 
 	if (!pipe_config->bw_constrained) {
 		DRM_DEBUG_KMS("forcing pipe bpc to %i for HDMI\n", desired_bpp);