Skip to content

Commit c09dedb

Browse files
tiwaiairlied
authored andcommitted
drm/edid: Add a workaround for 1366x768 HD panel
HD panel (1366x768) found most commonly on laptops can't be represented exactly in CVT/DMT expression, which leads to 1368x768 instead, because 1366 can't be divided by 8. Add a hack to convert to 1366x768 manually as an exception. Signed-off-by: Takashi Iwai <[email protected]> Acked-by: Adam Jackson <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
1 parent 0280917 commit c09dedb

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/gpu/drm/drm_edid.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,19 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
10391039
return modes;
10401040
}
10411041

1042+
/* fix up 1366x768 mode from 1368x768;
1043+
* GFT/CVT can't express 1366 width which isn't dividable by 8
1044+
*/
1045+
static void fixup_mode_1366x768(struct drm_display_mode *mode)
1046+
{
1047+
if (mode->hdisplay == 1368 && mode->vdisplay == 768) {
1048+
mode->hdisplay = 1366;
1049+
mode->hsync_start--;
1050+
mode->hsync_end--;
1051+
drm_mode_set_name(mode);
1052+
}
1053+
}
1054+
10421055
static int
10431056
drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
10441057
struct detailed_timing *timing)
@@ -1053,6 +1066,7 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
10531066
if (!newmode)
10541067
return modes;
10551068

1069+
fixup_mode_1366x768(newmode);
10561070
if (!mode_in_range(newmode, edid, timing)) {
10571071
drm_mode_destroy(dev, newmode);
10581072
continue;
@@ -1080,6 +1094,7 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
10801094
if (!newmode)
10811095
return modes;
10821096

1097+
fixup_mode_1366x768(newmode);
10831098
if (!mode_in_range(newmode, edid, timing)) {
10841099
drm_mode_destroy(dev, newmode);
10851100
continue;

0 commit comments

Comments
 (0)