* [PATCH] drm/edid: Support type 7 timings @ 2022-01-18 21:59 Yaroslav Bolyukin 2022-01-19 9:35 ` Jani Nikula 2022-01-23 19:19 ` [PATCH v2] " Yaroslav Bolyukin 0 siblings, 2 replies; 5+ messages in thread From: Yaroslav Bolyukin @ 2022-01-18 21:59 UTC (permalink / raw) To: linux-kernel, dri-devel Cc: Yaroslav Bolyukin, David Airlie, Thomas Zimmermann Per VESA DisplayID Standard v2.0: Type VII Timing – Detailed Timing Data Definitions were already provided as type I, but not used Signed-off-by: Yaroslav Bolyukin <iam@lach.pw> --- drivers/gpu/drm/drm_edid.c | 26 +++++++++++++++++--------- include/drm/drm_displayid.h | 6 +++--- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 12893e7be..5fcefd9b5 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -5404,13 +5404,17 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi return quirks; } -static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, - struct displayid_detailed_timings_1 *timings) +static struct drm_display_mode *drm_mode_displayid_detailed_1_7(struct drm_device *dev, + struct displayid_detailed_timings_1_7 *timings, + bool type_7) { struct drm_display_mode *mode; unsigned pixel_clock = (timings->pixel_clock[0] | (timings->pixel_clock[1] << 8) | (timings->pixel_clock[2] << 16)) + 1; + // type 7 allows higher precision pixel clock + if (!type_7) + pixel_clock *= 10; unsigned hactive = (timings->hactive[0] | timings->hactive[1] << 8) + 1; unsigned hblank = (timings->hblank[0] | timings->hblank[1] << 8) + 1; unsigned hsync = (timings->hsync[0] | (timings->hsync[1] & 0x7f) << 8) + 1; @@ -5426,7 +5430,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d if (!mode) return NULL; - mode->clock = pixel_clock * 10; + mode->clock = pixel_clock; mode->hdisplay = hactive; mode->hsync_start = mode->hdisplay + hsync; mode->hsync_end = mode->hsync_start + hsync_width; @@ -5449,10 +5453,12 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d return mode; } -static int add_displayid_detailed_1_modes(struct drm_connector *connector, - const struct displayid_block *block) +static int add_displayid_detailed_1_7_modes(struct drm_connector *connector, + const struct displayid_block *block, + bool type_7) { - struct displayid_detailed_timing_block *det = (struct displayid_detailed_timing_block *)block; + struct displayid_detailed_timing_1_7_block *det = + (struct displayid_detailed_timing_1_7_block *)block; int i; int num_timings; struct drm_display_mode *newmode; @@ -5463,9 +5469,9 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, num_timings = block->num_bytes / 20; for (i = 0; i < num_timings; i++) { - struct displayid_detailed_timings_1 *timings = &det->timings[i]; + struct displayid_detailed_timings_1_7 *timings = &det->timings[i]; - newmode = drm_mode_displayid_detailed(connector->dev, timings); + newmode = drm_mode_displayid_detailed_1_7(connector->dev, timings, type_7); if (!newmode) continue; @@ -5485,7 +5491,9 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, displayid_iter_edid_begin(edid, &iter); displayid_iter_for_each(block, &iter) { if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING) - num_modes += add_displayid_detailed_1_modes(connector, block); + num_modes += add_displayid_detailed_1_7_modes(connector, block, false); + else if (block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING) + num_modes += add_displayid_detailed_1_7_modes(connector, block, true); } displayid_iter_end(&iter); diff --git a/include/drm/drm_displayid.h b/include/drm/drm_displayid.h index 7ffbd9f7b..268ff5e1f 100644 --- a/include/drm/drm_displayid.h +++ b/include/drm/drm_displayid.h @@ -111,7 +111,7 @@ struct displayid_tiled_block { u8 topology_id[8]; } __packed; -struct displayid_detailed_timings_1 { +struct displayid_detailed_timings_1_7 { u8 pixel_clock[3]; u8 flags; u8 hactive[2]; @@ -124,9 +124,9 @@ struct displayid_detailed_timings_1 { u8 vsw[2]; } __packed; -struct displayid_detailed_timing_block { +struct displayid_detailed_timing_1_7_block { struct displayid_block base; - struct displayid_detailed_timings_1 timings[]; + struct displayid_detailed_timings_1_7 timings[]; }; #define DISPLAYID_VESA_MSO_OVERLAP GENMASK(3, 0) base-commit: 99613159ad749543621da8238acf1a122880144e -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] drm/edid: Support type 7 timings 2022-01-18 21:59 [PATCH] drm/edid: Support type 7 timings Yaroslav Bolyukin @ 2022-01-19 9:35 ` Jani Nikula 2022-01-23 19:19 ` [PATCH v2] " Yaroslav Bolyukin 1 sibling, 0 replies; 5+ messages in thread From: Jani Nikula @ 2022-01-19 9:35 UTC (permalink / raw) To: Yaroslav Bolyukin, linux-kernel, dri-devel Cc: David Airlie, Yaroslav Bolyukin, Thomas Zimmermann On Wed, 19 Jan 2022, Yaroslav Bolyukin <iam@lach.pw> wrote: > Per VESA DisplayID Standard v2.0: Type VII Timing – Detailed Timing Data > > Definitions were already provided as type I, but not used Thanks for the patch. Functionally I think it looks correct, and something we'll want. I do have some nitpicks though, comments inline. For the next version, please consider Cc'ing the intel-gfx list as well to get our CI results on it too. BR, Jani. > > Signed-off-by: Yaroslav Bolyukin <iam@lach.pw> > --- > drivers/gpu/drm/drm_edid.c | 26 +++++++++++++++++--------- > include/drm/drm_displayid.h | 6 +++--- > 2 files changed, 20 insertions(+), 12 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 12893e7be..5fcefd9b5 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -5404,13 +5404,17 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi > return quirks; > } > > -static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, > - struct displayid_detailed_timings_1 *timings) > +static struct drm_display_mode *drm_mode_displayid_detailed_1_7(struct drm_device *dev, > + struct displayid_detailed_timings_1_7 *timings, > + bool type_7) I think the function rename here is unnecessary. > { > struct drm_display_mode *mode; > unsigned pixel_clock = (timings->pixel_clock[0] | > (timings->pixel_clock[1] << 8) | > (timings->pixel_clock[2] << 16)) + 1; > + // type 7 allows higher precision pixel clock Please don't use // style comments. For the comment contents, I think you should just state the units for each; 10 kHz for type I, kHz for type VII. > + if (!type_7) > + pixel_clock *= 10; Please don't mix declarations and code. > unsigned hactive = (timings->hactive[0] | timings->hactive[1] << 8) + 1; > unsigned hblank = (timings->hblank[0] | timings->hblank[1] << 8) + 1; > unsigned hsync = (timings->hsync[0] | (timings->hsync[1] & 0x7f) << 8) + 1; > @@ -5426,7 +5430,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d > if (!mode) > return NULL; > > - mode->clock = pixel_clock * 10; > + mode->clock = pixel_clock; Since we used to have the multiplication here (and we don't mix declarations and code anyway) I'd keep it here. Maybe: mode->clock = type_7 ? pixel_clock : pixel_clock * 10; > mode->hdisplay = hactive; > mode->hsync_start = mode->hdisplay + hsync; > mode->hsync_end = mode->hsync_start + hsync_width; > @@ -5449,10 +5453,12 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d > return mode; > } > > -static int add_displayid_detailed_1_modes(struct drm_connector *connector, > - const struct displayid_block *block) > +static int add_displayid_detailed_1_7_modes(struct drm_connector *connector, > + const struct displayid_block *block, > + bool type_7) > { > - struct displayid_detailed_timing_block *det = (struct displayid_detailed_timing_block *)block; > + struct displayid_detailed_timing_1_7_block *det = > + (struct displayid_detailed_timing_1_7_block *)block; I think the displayid_detailed_timing_block -> displayid_detailed_timing_1_7_block rename is unnecessary. > int i; > int num_timings; > struct drm_display_mode *newmode; > @@ -5463,9 +5469,9 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, > > num_timings = block->num_bytes / 20; > for (i = 0; i < num_timings; i++) { > - struct displayid_detailed_timings_1 *timings = &det->timings[i]; > + struct displayid_detailed_timings_1_7 *timings = &det->timings[i]; > > - newmode = drm_mode_displayid_detailed(connector->dev, timings); > + newmode = drm_mode_displayid_detailed_1_7(connector->dev, timings, type_7); > if (!newmode) > continue; > > @@ -5485,7 +5491,9 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, > displayid_iter_edid_begin(edid, &iter); > displayid_iter_for_each(block, &iter) { > if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING) > - num_modes += add_displayid_detailed_1_modes(connector, block); > + num_modes += add_displayid_detailed_1_7_modes(connector, block, false); > + else if (block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING) > + num_modes += add_displayid_detailed_1_7_modes(connector, block, true); I'd probably not add a true/false parameter here, since we pass in block anyway, and the function can have and initialize the bool local variable internally based on block->tag. > } > displayid_iter_end(&iter); > > diff --git a/include/drm/drm_displayid.h b/include/drm/drm_displayid.h > index 7ffbd9f7b..268ff5e1f 100644 > --- a/include/drm/drm_displayid.h > +++ b/include/drm/drm_displayid.h > @@ -111,7 +111,7 @@ struct displayid_tiled_block { > u8 topology_id[8]; > } __packed; > > -struct displayid_detailed_timings_1 { > +struct displayid_detailed_timings_1_7 { > u8 pixel_clock[3]; > u8 flags; > u8 hactive[2]; > @@ -124,9 +124,9 @@ struct displayid_detailed_timings_1 { > u8 vsw[2]; > } __packed; > > -struct displayid_detailed_timing_block { > +struct displayid_detailed_timing_1_7_block { Like I said, I wouldn't rename this. > struct displayid_block base; > - struct displayid_detailed_timings_1 timings[]; > + struct displayid_detailed_timings_1_7 timings[]; > }; > > #define DISPLAYID_VESA_MSO_OVERLAP GENMASK(3, 0) > > base-commit: 99613159ad749543621da8238acf1a122880144e -- Jani Nikula, Intel Open Source Graphics Center ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] drm/edid: Support type 7 timings 2022-01-18 21:59 [PATCH] drm/edid: Support type 7 timings Yaroslav Bolyukin 2022-01-19 9:35 ` Jani Nikula @ 2022-01-23 19:19 ` Yaroslav Bolyukin 2022-01-25 7:02 ` Jani Nikula 1 sibling, 1 reply; 5+ messages in thread From: Yaroslav Bolyukin @ 2022-01-23 19:19 UTC (permalink / raw) To: linux-kernel, dri-devel Cc: David Airlie, intel-gfx, Thomas Zimmermann, Yaroslav Bolyukin Per VESA DisplayID Standard v2.0: Type VII Timing – Detailed Timing Data Definitions were already provided as type I, but not used Signed-off-by: Yaroslav Bolyukin <iam@lach.pw> --- drivers/gpu/drm/drm_edid.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 12893e7be..5f2ae5bfa 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -5405,7 +5405,8 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi } static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, - struct displayid_detailed_timings_1 *timings) + struct displayid_detailed_timings_1 *timings, + bool type_7) { struct drm_display_mode *mode; unsigned pixel_clock = (timings->pixel_clock[0] | @@ -5426,7 +5427,8 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d if (!mode) return NULL; - mode->clock = pixel_clock * 10; + /* resolution is kHz for type VII, and 10 kHz for type I */ + mode->clock = type_7 ? pixel_clock : pixel_clock * 10; mode->hdisplay = hactive; mode->hsync_start = mode->hdisplay + hsync; mode->hsync_end = mode->hsync_start + hsync_width; @@ -5457,6 +5459,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, int num_timings; struct drm_display_mode *newmode; int num_modes = 0; + bool type_7 = block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING; /* blocks must be multiple of 20 bytes length */ if (block->num_bytes % 20) return 0; @@ -5465,7 +5468,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, for (i = 0; i < num_timings; i++) { struct displayid_detailed_timings_1 *timings = &det->timings[i]; - newmode = drm_mode_displayid_detailed(connector->dev, timings); + newmode = drm_mode_displayid_detailed(connector->dev, timings, type_7); if (!newmode) continue; @@ -5484,7 +5487,8 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, displayid_iter_edid_begin(edid, &iter); displayid_iter_for_each(block, &iter) { - if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING) + if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING || + block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING) num_modes += add_displayid_detailed_1_modes(connector, block); } displayid_iter_end(&iter); base-commit: 99613159ad749543621da8238acf1a122880144e -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] drm/edid: Support type 7 timings 2022-01-23 19:19 ` [PATCH v2] " Yaroslav Bolyukin @ 2022-01-25 7:02 ` Jani Nikula 2022-01-25 12:35 ` Jani Nikula 0 siblings, 1 reply; 5+ messages in thread From: Jani Nikula @ 2022-01-25 7:02 UTC (permalink / raw) To: Yaroslav Bolyukin, linux-kernel, dri-devel Cc: David Airlie, intel-gfx, Thomas Zimmermann, Yaroslav Bolyukin On Sun, 23 Jan 2022, Yaroslav Bolyukin <iam@lach.pw> wrote: > Per VESA DisplayID Standard v2.0: Type VII Timing – Detailed Timing Data > > Definitions were already provided as type I, but not used > > Signed-off-by: Yaroslav Bolyukin <iam@lach.pw> Reviewed-by: Jani Nikula <jani.nikula@intel.com> > --- > drivers/gpu/drm/drm_edid.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 12893e7be..5f2ae5bfa 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -5405,7 +5405,8 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi > } > > static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, > - struct displayid_detailed_timings_1 *timings) > + struct displayid_detailed_timings_1 *timings, > + bool type_7) > { > struct drm_display_mode *mode; > unsigned pixel_clock = (timings->pixel_clock[0] | > @@ -5426,7 +5427,8 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d > if (!mode) > return NULL; > > - mode->clock = pixel_clock * 10; > + /* resolution is kHz for type VII, and 10 kHz for type I */ > + mode->clock = type_7 ? pixel_clock : pixel_clock * 10; > mode->hdisplay = hactive; > mode->hsync_start = mode->hdisplay + hsync; > mode->hsync_end = mode->hsync_start + hsync_width; > @@ -5457,6 +5459,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, > int num_timings; > struct drm_display_mode *newmode; > int num_modes = 0; > + bool type_7 = block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING; > /* blocks must be multiple of 20 bytes length */ > if (block->num_bytes % 20) > return 0; > @@ -5465,7 +5468,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, > for (i = 0; i < num_timings; i++) { > struct displayid_detailed_timings_1 *timings = &det->timings[i]; > > - newmode = drm_mode_displayid_detailed(connector->dev, timings); > + newmode = drm_mode_displayid_detailed(connector->dev, timings, type_7); > if (!newmode) > continue; > > @@ -5484,7 +5487,8 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, > > displayid_iter_edid_begin(edid, &iter); > displayid_iter_for_each(block, &iter) { > - if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING) > + if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING || > + block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING) > num_modes += add_displayid_detailed_1_modes(connector, block); > } > displayid_iter_end(&iter); > > base-commit: 99613159ad749543621da8238acf1a122880144e -- Jani Nikula, Intel Open Source Graphics Center ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] drm/edid: Support type 7 timings 2022-01-25 7:02 ` Jani Nikula @ 2022-01-25 12:35 ` Jani Nikula 0 siblings, 0 replies; 5+ messages in thread From: Jani Nikula @ 2022-01-25 12:35 UTC (permalink / raw) To: Yaroslav Bolyukin, linux-kernel, dri-devel Cc: David Airlie, intel-gfx, Thomas Zimmermann, Yaroslav Bolyukin On Tue, 25 Jan 2022, Jani Nikula <jani.nikula@linux.intel.com> wrote: > On Sun, 23 Jan 2022, Yaroslav Bolyukin <iam@lach.pw> wrote: >> Per VESA DisplayID Standard v2.0: Type VII Timing – Detailed Timing Data >> >> Definitions were already provided as type I, but not used >> >> Signed-off-by: Yaroslav Bolyukin <iam@lach.pw> > > Reviewed-by: Jani Nikula <jani.nikula@intel.com> And pushed to drm-misc-next, thanks for the patch. BR, Jani. > >> --- >> drivers/gpu/drm/drm_edid.c | 12 ++++++++---- >> 1 file changed, 8 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c >> index 12893e7be..5f2ae5bfa 100644 >> --- a/drivers/gpu/drm/drm_edid.c >> +++ b/drivers/gpu/drm/drm_edid.c >> @@ -5405,7 +5405,8 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edi >> } >> >> static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dev, >> - struct displayid_detailed_timings_1 *timings) >> + struct displayid_detailed_timings_1 *timings, >> + bool type_7) >> { >> struct drm_display_mode *mode; >> unsigned pixel_clock = (timings->pixel_clock[0] | >> @@ -5426,7 +5427,8 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d >> if (!mode) >> return NULL; >> >> - mode->clock = pixel_clock * 10; >> + /* resolution is kHz for type VII, and 10 kHz for type I */ >> + mode->clock = type_7 ? pixel_clock : pixel_clock * 10; >> mode->hdisplay = hactive; >> mode->hsync_start = mode->hdisplay + hsync; >> mode->hsync_end = mode->hsync_start + hsync_width; >> @@ -5457,6 +5459,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, >> int num_timings; >> struct drm_display_mode *newmode; >> int num_modes = 0; >> + bool type_7 = block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING; >> /* blocks must be multiple of 20 bytes length */ >> if (block->num_bytes % 20) >> return 0; >> @@ -5465,7 +5468,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, >> for (i = 0; i < num_timings; i++) { >> struct displayid_detailed_timings_1 *timings = &det->timings[i]; >> >> - newmode = drm_mode_displayid_detailed(connector->dev, timings); >> + newmode = drm_mode_displayid_detailed(connector->dev, timings, type_7); >> if (!newmode) >> continue; >> >> @@ -5484,7 +5487,8 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, >> >> displayid_iter_edid_begin(edid, &iter); >> displayid_iter_for_each(block, &iter) { >> - if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING) >> + if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING || >> + block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING) >> num_modes += add_displayid_detailed_1_modes(connector, block); >> } >> displayid_iter_end(&iter); >> >> base-commit: 99613159ad749543621da8238acf1a122880144e -- Jani Nikula, Intel Open Source Graphics Center ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-01-25 12:35 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-01-18 21:59 [PATCH] drm/edid: Support type 7 timings Yaroslav Bolyukin 2022-01-19 9:35 ` Jani Nikula 2022-01-23 19:19 ` [PATCH v2] " Yaroslav Bolyukin 2022-01-25 7:02 ` Jani Nikula 2022-01-25 12:35 ` Jani Nikula
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox