From: Adam Jackson <ajax@redhat.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 3/3] drm/edid: Add csync parsing
Date: Wed, 6 Jun 2012 15:07:53 -0400 [thread overview]
Message-ID: <1339009673-30704-3-git-send-email-ajax@redhat.com> (raw)
In-Reply-To: <1339009673-30704-1-git-send-email-ajax@redhat.com>
Just assume saying "this is csync" is enough for whatever the output
type is. The xfree86 mode flags distinguish between positive and
negative csync, but EDID doesn't encode that.
No connector types set csync_allowed yet, so this is a no-op besides
getting the message to shut up.
Signed-off-by: Adam Jackson <ajax@redhat.com>
---
drivers/gpu/drm/drm_crtc.c | 2 +-
drivers/gpu/drm/drm_crtc_helper.c | 5 +++++
drivers/gpu/drm/drm_edid.c | 29 +++++++++++++++++++++--------
include/drm/drm_crtc.h | 2 ++
include/drm/drm_edid.h | 15 ++++++++++-----
include/drm/drm_mode.h | 4 ++++
6 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 08a7aa7..265efe8 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1081,7 +1081,7 @@ static void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out,
out->vtotal = in->vtotal;
out->vscan = in->vscan;
out->vrefresh = in->vrefresh;
- out->flags = in->flags;
+ out->flags = in->flags & DRM_MODE_FLAG_USERSPACE_MASK;
out->type = in->type;
strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
out->name[DRM_DISPLAY_MODE_LEN-1] = 0;
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 3252e70..d4625db 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -57,6 +57,9 @@ static void drm_mode_validate_flag(struct drm_connector *connector,
if ((mode->flags & DRM_MODE_FLAG_DBLSCAN) &&
!(flags & DRM_MODE_FLAG_DBLSCAN))
mode->status = MODE_NO_DBLESCAN;
+ if ((mode->flags & DRM_MODE_FLAG_CSYNC) &&
+ !(flags & DRM_MODE_FLAG_CSYNC))
+ mode->status = MODE_NO_CSYNC;
}
return;
@@ -140,6 +143,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
mode_flags |= DRM_MODE_FLAG_INTERLACE;
if (connector->doublescan_allowed)
mode_flags |= DRM_MODE_FLAG_DBLSCAN;
+ if (connector->csync_allowed)
+ mode_flags |= DRM_MODE_FLAG_CSYNC;
drm_mode_validate_flag(connector, mode_flags);
list_for_each_entry(mode, &connector->modes, head) {
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index be21040..a8af442 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -857,10 +857,27 @@ static void
drm_mode_detailed_set_sync_flags(struct detailed_pixel_timing *pt,
unsigned int *flags)
{
- *flags |= (pt->misc & DRM_EDID_PT_HSYNC_POSITIVE) ?
- DRM_MODE_FLAG_PHSYNC : DRM_MODE_FLAG_NHSYNC;
- *flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ?
- DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC;
+ switch (pt->misc & DRM_EDID_PT_SEPARATE_SYNC) {
+ case DRM_EDID_PT_SEPARATE_SYNC: /* digital, separate */
+ *flags |= (pt->misc & DRM_EDID_PT_HSYNC_POSITIVE) ?
+ DRM_MODE_FLAG_PHSYNC : DRM_MODE_FLAG_NHSYNC;
+ *flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ?
+ DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC;
+ break;
+ case DRM_EDID_PT_DIGITAL_CSYNC: /* digital, composite */
+ *flags |= DRM_MODE_FLAG_CSYNC;
+ if (pt->misc & DRM_EDID_PT_CSYNC_SERRATION)
+ *flags |= DRM_MODE_FLAG_SYNC_SERRATION;
+ break;
+ case DRM_EDID_PT_BIANALOG_CSYNC: /* bipolar analog composite */
+ case DRM_EDID_PT_ANALOG_CSYNC: /* unipolar analog composite */
+ *flags |= DRM_MODE_FLAG_CSYNC;
+ if (pt->misc & DRM_EDID_PT_CSYNC_SERRATION)
+ *flags |= DRM_MODE_FLAG_SYNC_SERRATION;
+ if (pt->misc & DRM_EDID_PT_CSYNC_RGB)
+ *flags |= DRM_MODE_FLAG_SYNC_RGB; /* else sync-on-green */
+ break;
+ }
}
/**
@@ -898,10 +915,6 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
return NULL;
}
- if (!(pt->misc & DRM_EDID_PT_SEPARATE_SYNC)) {
- printk(KERN_WARNING "composite sync not supported\n");
- }
-
/* it is incorrect if hsync/vsync width is zero */
if (!hsync_pulse_width || !vsync_pulse_width) {
DRM_DEBUG_KMS("Incorrect Detailed timing. "
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 73e4560..d0c958e 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -105,6 +105,7 @@ enum drm_mode_status {
MODE_ONE_HEIGHT, /* only one height is supported */
MODE_ONE_SIZE, /* only one resolution is supported */
MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
+ MODE_NO_CSYNC, /* connector doesn't support composite sync */
MODE_UNVERIFIED = -3, /* mode needs to reverified */
MODE_BAD = -2, /* unspecified reason */
MODE_ERROR = -1 /* error condition */
@@ -560,6 +561,7 @@ struct drm_connector {
int connector_type_id;
bool interlace_allowed;
bool doublescan_allowed;
+ bool csync_allowed;
struct list_head modes; /* list of modes on this connector */
enum drm_connector_status status;
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 6350ea0..eb033fc 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -53,11 +53,16 @@ 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_STEREO_MASK (3 << 5)
-#define DRM_EDID_PT_INTERLACED (1 << 7)
+#define DRM_EDID_PT_HSYNC_POSITIVE (1 << 1)
+#define DRM_EDID_PT_CSYNC_RGB (1 << 1)
+#define DRM_EDID_PT_VSYNC_POSITIVE (1 << 2)
+#define DRM_EDID_PT_CSYNC_SERRATION (1 << 2)
+#define DRM_EDID_PT_ANALOG_CSYNC (0 << 3)
+#define DRM_EDID_PT_BIANALOG_CSYNC (1 << 3)
+#define DRM_EDID_PT_DIGITAL_CSYNC (2 << 3)
+#define DRM_EDID_PT_SEPARATE_SYNC (3 << 3)
+#define DRM_EDID_PT_STEREO_MASK (3 << 5)
+#define DRM_EDID_PT_INTERLACED (1 << 7)
/* If detailed data is pixel timing */
struct detailed_pixel_timing {
diff --git a/include/drm/drm_mode.h b/include/drm/drm_mode.h
index 5581980..c1e043b 100644
--- a/include/drm/drm_mode.h
+++ b/include/drm/drm_mode.h
@@ -58,6 +58,10 @@
#define DRM_MODE_FLAG_PIXMUX (1<<11)
#define DRM_MODE_FLAG_DBLCLK (1<<12)
#define DRM_MODE_FLAG_CLKDIV2 (1<<13)
+/* hide our internal flags for now */
+#define DRM_MODE_FLAG_USERSPACE_MASK ((1 << 14) - 1)
+#define DRM_MODE_FLAG_SYNC_SERRATION (1 << 30)
+#define DRM_MODE_FLAG_SYNC_RGB (1 << 31)
/* DPMS flags */
/* bit compatible with the xorg definitions. */
--
1.7.7.6
next prev parent reply other threads:[~2012-06-06 19:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-06 19:07 [PATCH 1/3] drm/edid: Be stricter about stereo mode rejection Adam Jackson
2012-06-06 19:07 ` [PATCH 2/3] drm/edid: Pull mode sync flag setup out to its own function Adam Jackson
2012-06-06 19:07 ` Adam Jackson [this message]
2012-08-31 18:03 ` [PATCH 1/3] drm/edid: Be stricter about stereo mode rejection Adam Jackson
2012-08-31 18:21 ` Alex Deucher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339009673-30704-3-git-send-email-ajax@redhat.com \
--to=ajax@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.