drm/edid: fixup EDID 1.3 and 1.4 judge reduced-blanking timings logic
Subsystems (2)
PATCH 1/1 drm/edid: fixup EDID 1.3 and 1.4 judge reduced-blanking timings logic
According to VESA ENHANCED EXTENDED DISPLAY IDENTIFICATION DATA STANDARD (Defines EDID Structure Version 1, Revision 4) page: 39
How to determine whether the monitor support RB timing or not? EDID 1.4
First: read detailed timing descriptor and make sure byte0 = 0,
byte1 = 0, byte2 = 0 and byte3 = 0xFD
Second: read detailed timing descriptor byte10 = 0x04 and
EDID byte18h bit0 = 1
Third: if EDID byte18h bit0 == 1 && byte10 == 0x04,
then we can check byte15, if byte15 bit4 =1 is support RB if EDID byte18h bit0 != 1 || byte10 != 0x04, then byte15 can not be used
The linux code is_rb function not follow the VESA's rule
EDID 1.3
LCD flat panels do not require long blanking intervals as a retrace period so default support reduced-blanking timings.
--- drivers/gpu/drm/drm_edid.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_edid.c +21 -7
@@ -93,6 +93,11 @@ struct detailed_mode_closure {int modes; }; +struct edid_support_rb_closure { +struct edid *edid; +u8 support_rb; +}; +#define LEVEL_DMT 0#define LEVEL_GTF 1#define LEVEL_GTF2 2
@@ -2018,22 +2023,31 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, is_rb(struct detailed_timing *t, void *data) { u8 *r = (u8 *)t; -if (r[3 ] ==EDID_DETAIL_MONITOR_RANGE ) -if (r[15 ] &0x10 ) - *(bool *)data = true; +struct edid_support_rb_closure *closure = data; +struct edid *edid = closure->edid; + +if (!r[0 ] && !r[1 ] && !r[2 ] && r[3 ] ==EDID_DETAIL_MONITOR_RANGE ) { +if (edid->features &BIT (0 ) && r[10 ] ==BIT (2 )) + closure->support_rb = (r[15 ] &0x10 ) ?1 :0 ; + } }/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ static bool drm_monitor_supports_rb (struct edid *edid) { +struct edid_support_rb_closure closure = { + .edid = edid, + .support_rb =-1 , + }; +if (edid->revision >=4 ) { -bool ret = false; -drm_for_each_detailed_block ((u8 *)edid, is_rb, &ret); -return ret; +drm_for_each_detailed_block ((u8 *)edid, is_rb, &closure); +if (closure.support_rb >=0 ) +return closure.support_rb; } -return ((edid->input &DRM_EDID_INPUT_DIGITAL ) !=0 ); +return true; } static void
Signature · 1 line
1.9.1
kbuild test robot
build botI love your patch! Perhaps something to improve:
Hi allen,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.4-rc5 next-20191031]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/allen/drm-edid-fixup-EDID-1-3-and-1-4-judge-reduced-blanking-timings-logic/20191102-200357 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1204c70d9dcba31164f78ad5d8c88c42335d51f8
If you fix the issue, kindly add following tag
smatch warnings:drivers/gpu/drm/drm_edid.c:2042 drm_monitor_supports_rb() warn: always true condition '(closure.support_rb >= 0) => (0-255 >= 0)'
vim +2042 drivers/gpu/drm/drm_edid.c
2030
2031 /* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */
2032 static bool
2033 drm_monitor_supports_rb(struct edid *edid)
2034 {
2035 struct edid_support_rb_closure closure = {
2036 .edid = edid,
2037 .support_rb = -1,
2038 };
2039
2040 if (edid->revision >= 4) {
2041 drm_for_each_detailed_block((u8 *)edid, is_rb, &closure);
> 2042 if (closure.support_rb >= 0)
2043 return closure.support_rb;
2044 }
2045
2046 return true;
2047 }
2048
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation