Commit 969218fe authored by Takashi Iwai's avatar Takashi Iwai Committed by Ville Syrjälä

drm: Clean up the 1366x768 fixup codes

This is just a cleanup, no functional change.

The fixup code for 1366x768 in drm_mode_create_from_cmdline_mode() is
basically a copy of the existing code in drm_edid.c.  Make the latter
code public so that it can be called from the former function.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: http://patchwork.freedesktop.org/patch/msgid/20170117164329.10551-1-tiwai@suse.deReviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
[vsyrjala: include drm_crtc_internal.h to make sparse happy]
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
parent 45bf86e7
...@@ -207,3 +207,6 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev, ...@@ -207,3 +207,6 @@ int drm_mode_cursor2_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv); void *data, struct drm_file *file_priv);
int drm_mode_page_flip_ioctl(struct drm_device *dev, int drm_mode_page_flip_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv); void *data, struct drm_file *file_priv);
/* drm_edid.c */
void drm_mode_fixup_1366x768(struct drm_display_mode *mode);
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <drm/drm_encoder.h> #include <drm/drm_encoder.h>
#include <drm/drm_displayid.h> #include <drm/drm_displayid.h>
#include "drm_crtc_internal.h"
#define version_greater(edid, maj, min) \ #define version_greater(edid, maj, min) \
(((edid)->version > (maj)) || \ (((edid)->version > (maj)) || \
((edid)->version == (maj) && (edid)->revision > (min))) ((edid)->version == (maj) && (edid)->revision > (min)))
...@@ -2153,7 +2155,7 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid, ...@@ -2153,7 +2155,7 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
/* fix up 1366x768 mode from 1368x768; /* fix up 1366x768 mode from 1368x768;
* GFT/CVT can't express 1366 width which isn't dividable by 8 * GFT/CVT can't express 1366 width which isn't dividable by 8
*/ */
static void fixup_mode_1366x768(struct drm_display_mode *mode) void drm_mode_fixup_1366x768(struct drm_display_mode *mode)
{ {
if (mode->hdisplay == 1368 && mode->vdisplay == 768) { if (mode->hdisplay == 1368 && mode->vdisplay == 768) {
mode->hdisplay = 1366; mode->hdisplay = 1366;
...@@ -2177,7 +2179,7 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid, ...@@ -2177,7 +2179,7 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
if (!newmode) if (!newmode)
return modes; return modes;
fixup_mode_1366x768(newmode); drm_mode_fixup_1366x768(newmode);
if (!mode_in_range(newmode, edid, timing) || if (!mode_in_range(newmode, edid, timing) ||
!valid_inferred_mode(connector, newmode)) { !valid_inferred_mode(connector, newmode)) {
drm_mode_destroy(dev, newmode); drm_mode_destroy(dev, newmode);
...@@ -2206,7 +2208,7 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid, ...@@ -2206,7 +2208,7 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
if (!newmode) if (!newmode)
return modes; return modes;
fixup_mode_1366x768(newmode); drm_mode_fixup_1366x768(newmode);
if (!mode_in_range(newmode, edid, timing) || if (!mode_in_range(newmode, edid, timing) ||
!valid_inferred_mode(connector, newmode)) { !valid_inferred_mode(connector, newmode)) {
drm_mode_destroy(dev, newmode); drm_mode_destroy(dev, newmode);
......
...@@ -1481,12 +1481,8 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev, ...@@ -1481,12 +1481,8 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev,
mode->type |= DRM_MODE_TYPE_USERDEF; mode->type |= DRM_MODE_TYPE_USERDEF;
/* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */ /* fix up 1368x768: GFT/CVT can't express 1366 width due to alignment */
if (cmd->xres == 1366 && mode->hdisplay == 1368) { if (cmd->xres == 1366)
mode->hdisplay = 1366; drm_mode_fixup_1366x768(mode);
mode->hsync_start--;
mode->hsync_end--;
drm_mode_set_name(mode);
}
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V); drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
return mode; return mode;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment