ALT Linux kernel packages development
 help / color / mirror / Atom feed
* [d-kernel] [PATCH 0/1] Fix sync issue for ATOL all-in-one PC in 5.15
@ 2023-03-02 12:09 nickel
  2023-03-02 12:09 ` [d-kernel] [PATCH] drm/edid: Fix csync detailed mode parsing nickel
  2023-03-02 16:03 ` [d-kernel] [PATCH 0/1] Fix sync issue for ATOL all-in-one PC in 5.15 Vitaly Chikunov
  0 siblings, 2 replies; 3+ messages in thread
From: nickel @ 2023-03-02 12:09 UTC (permalink / raw)
  To: devel-kernel

This patch is adapted for 5.15 kernels (both std-def in Sisyphus and un-def in p10).

[PATCH 1/1] drm/edid: Fix csync detailed mode parsing



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

* [d-kernel] [PATCH] drm/edid: Fix csync detailed mode parsing
  2023-03-02 12:09 [d-kernel] [PATCH 0/1] Fix sync issue for ATOL all-in-one PC in 5.15 nickel
@ 2023-03-02 12:09 ` nickel
  2023-03-02 16:03 ` [d-kernel] [PATCH 0/1] Fix sync issue for ATOL all-in-one PC in 5.15 Vitaly Chikunov
  1 sibling, 0 replies; 3+ messages in thread
From: nickel @ 2023-03-02 12:09 UTC (permalink / raw)
  To: devel-kernel; +Cc: Jani Nikula, Ville Syrjälä, Vasiliy Kovalev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

commit ca62297b2085b5b3168bd891ca24862242c635a1 upstream.

Remove the bogus csync check and replace it with something that:
- triggers for all forms of csync, not just the basic analog variant
- actually populates the mode csync flags so that drivers can
  decide what to do with the mode

Originally the code tried to outright reject csync, but that
apparently broke some bogus LCD monitor that claimed to have
a detailed mode that uses analog csync, despite also claiming
the monitor only support separate sync:
https://bugzilla.redhat.com/show_bug.cgi?id=540024
Potentially that monitor should just be quirked or something.

Anyways, what we are dealing with now is some kind of funny i915
JSL machine with eDP where the panel claims to support a sensible
60Hz separate sync mode, and a 50Hz mode with bipolar analog
csync. The 50Hz mode does not work so we want to not use it.
Easiest way is to just correctly flag it as csync and the driver
will reject it.

TODO: or should we just reject any form of csync (or at least
the analog variants) for digital display interfaces?

v2: Grab digital csync polarity from hsync polarity bit (Jani)

This patch has been adapted for kernel 5.15 (Kovalev)

Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8146
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230228213610.26283-1-ville.syrjala@linux.intel.com
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
Signed-off-by: Nikolai Kostrigin <nickel@altlinux.org>
---
 drivers/gpu/drm/drm_edid.c | 30 +++++++++++++++++++++---------
 include/drm/drm_edid.h     | 12 +++++++++---
 2 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index d940c76419c5a..efd42bc36bd03 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2636,9 +2636,6 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
 		DRM_DEBUG_KMS("stereo mode not supported\n");
 		return NULL;
 	}
-	if (!(pt->misc & DRM_EDID_PT_SEPARATE_SYNC)) {
-		DRM_DEBUG_KMS("composite sync not supported\n");
-	}
 
 	/* it is incorrect if hsync/vsync width is zero */
 	if (!hsync_pulse_width || !vsync_pulse_width) {
@@ -2683,14 +2680,29 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
 	drm_mode_do_interlace_quirk(mode, pt);
 
 	if (quirks & EDID_QUIRK_DETAILED_SYNC_PP) {
-		pt->misc |= DRM_EDID_PT_HSYNC_POSITIVE | DRM_EDID_PT_VSYNC_POSITIVE;
+		mode->flags |= DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC;
+	} else {
+		switch (pt->misc & DRM_EDID_PT_SYNC_MASK) {
+		case DRM_EDID_PT_ANALOG_CSYNC:
+		case DRM_EDID_PT_BIPOLAR_ANALOG_CSYNC:
+			drm_dbg_kms(dev, "Analog composite sync!\n");
+			mode->flags |= DRM_MODE_FLAG_CSYNC | DRM_MODE_FLAG_NCSYNC;
+			break;
+		case DRM_EDID_PT_DIGITAL_CSYNC:
+			drm_dbg_kms(dev, "Digital composite sync!\n");
+			mode->flags |= DRM_MODE_FLAG_CSYNC;
+			mode->flags |= (pt->misc & DRM_EDID_PT_HSYNC_POSITIVE) ?
+				DRM_MODE_FLAG_PCSYNC : DRM_MODE_FLAG_NCSYNC;
+			break;
+		case DRM_EDID_PT_DIGITAL_SEPARATE_SYNC:
+			mode->flags |= (pt->misc & DRM_EDID_PT_HSYNC_POSITIVE) ?
+				DRM_MODE_FLAG_PHSYNC : DRM_MODE_FLAG_NHSYNC;
+			mode->flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ?
+				DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC;
+			break;
+		}
 	}
 
-	mode->flags |= (pt->misc & DRM_EDID_PT_HSYNC_POSITIVE) ?
-		DRM_MODE_FLAG_PHSYNC : DRM_MODE_FLAG_NHSYNC;
-	mode->flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ?
-		DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC;
-
 set_size:
 	mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi & 0xf0) << 4;
 	mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi & 0xf) << 8;
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index c24559f5329dd..02749aabf34b9 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -60,9 +60,15 @@ struct std_timing {
 	u8 vfreq_aspect;
 } __attribute__((packed));
 
-#define DRM_EDID_PT_HSYNC_POSITIVE (1 << 1)
-#define DRM_EDID_PT_VSYNC_POSITIVE (1 << 2)
-#define DRM_EDID_PT_SEPARATE_SYNC  (3 << 3)
+#define DRM_EDID_PT_SYNC_MASK              (3 << 3)
+# define DRM_EDID_PT_ANALOG_CSYNC          (0 << 3)
+# define DRM_EDID_PT_BIPOLAR_ANALOG_CSYNC  (1 << 3)
+# define DRM_EDID_PT_DIGITAL_CSYNC         (2 << 3)
+#  define DRM_EDID_PT_CSYNC_ON_RGB         (1 << 1) /* analog csync only */
+#  define DRM_EDID_PT_CSYNC_SERRATE        (1 << 2)
+# define DRM_EDID_PT_DIGITAL_SEPARATE_SYNC (3 << 3)
+#  define DRM_EDID_PT_HSYNC_POSITIVE       (1 << 1) /* also digital csync */
+#  define DRM_EDID_PT_VSYNC_POSITIVE       (1 << 2)
 #define DRM_EDID_PT_STEREO         (1 << 5)
 #define DRM_EDID_PT_INTERLACED     (1 << 7)
 
-- 
2.33.6



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

* Re: [d-kernel] [PATCH 0/1] Fix sync issue for ATOL all-in-one PC in 5.15
  2023-03-02 12:09 [d-kernel] [PATCH 0/1] Fix sync issue for ATOL all-in-one PC in 5.15 nickel
  2023-03-02 12:09 ` [d-kernel] [PATCH] drm/edid: Fix csync detailed mode parsing nickel
@ 2023-03-02 16:03 ` Vitaly Chikunov
  1 sibling, 0 replies; 3+ messages in thread
From: Vitaly Chikunov @ 2023-03-02 16:03 UTC (permalink / raw)
  To: ALT Linux kernel packages development

On Thu, Mar 02, 2023 at 03:09:50PM +0300, nickel@altlinux.org wrote:
> This patch is adapted for 5.15 kernels (both std-def in Sisyphus and un-def in p10).
> 
> [PATCH 1/1] drm/edid: Fix csync detailed mode parsing

Applied, thanks.

> 
> _______________________________________________
> devel-kernel mailing list
> devel-kernel@lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/devel-kernel


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

end of thread, other threads:[~2023-03-02 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-02 12:09 [d-kernel] [PATCH 0/1] Fix sync issue for ATOL all-in-one PC in 5.15 nickel
2023-03-02 12:09 ` [d-kernel] [PATCH] drm/edid: Fix csync detailed mode parsing nickel
2023-03-02 16:03 ` [d-kernel] [PATCH 0/1] Fix sync issue for ATOL all-in-one PC in 5.15 Vitaly Chikunov

ALT Linux kernel packages development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
		devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
	public-inbox-index devel-kernel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git