From 9ea2228a30c8616399ad74b551e04e7ec8155f74 Mon Sep 17 00:00:00 2001
From: Egbert Eich <eich@suse.de>
Date: Tue, 18 Jul 2017 16:43:07 +0200
Message-Id: <20170718144320.8354-2-tiwai@suse.de>
Subject: [PATCH 01/14] drm/mgag200: Add doublescan and interlace support
Patch-mainline: Submitted, dri-devel ML
References: bnc#893040
This code was ported from the xorg mga driver.
The doublescreen_allowed and interlace_allowed flags are set
unconditionally for all models for now.
Signed-off-by: Egbert Eich <eich@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
drivers/gpu/drm/mgag200/mgag200_mode.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -1592,7 +1592,9 @@ static enum drm_mode_status mga_vga_mode
struct drm_device *dev = connector->dev;
struct mga_device *mdev = (struct mga_device*)dev->dev_private;
int bpp = 32;
+ int lace;
+ lace = (mode->flags & DRM_MODE_FLAG_INTERLACE) ? 2 : 1;
if (IS_G200_SE(mdev)) {
if (mdev->unique_rev_id == 0x01) {
if (mode->hdisplay > 1600)
@@ -1644,8 +1646,10 @@ static enum drm_mode_status mga_vga_mode
if (mode->crtc_hdisplay > 2048 || mode->crtc_hsync_start > 4096 ||
mode->crtc_hsync_end > 4096 || mode->crtc_htotal > 4096 ||
- mode->crtc_vdisplay > 2048 || mode->crtc_vsync_start > 4096 ||
- mode->crtc_vsync_end > 4096 || mode->crtc_vtotal > 4096) {
+ mode->crtc_vdisplay > 2048 * lace ||
+ mode->crtc_vsync_start > 4096 * lace ||
+ mode->crtc_vsync_end > 4096 * lace ||
+ mode->crtc_vtotal > 4096 * lace) {
return MODE_BAD;
}
@@ -1705,6 +1709,9 @@ static struct drm_connector *mga_vga_ini
connector = &mga_connector->base;
+ connector->interlace_allowed = true;
+ connector->doublescan_allowed = true;
+
drm_connector_init(dev, connector,
&mga_vga_connector_funcs, DRM_MODE_CONNECTOR_VGA);