On Thu, Oct 03, 2019 at 01:52:58PM +0530, Sharma, Shashank wrote: > > On 9/25/2019 7:25 PM, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > > > Add a second table to the cea modes with VIC >= 193. > > > > Cc: Hans Verkuil <hansverk@xxxxxxxxx> > > Cc: Shashank Sharma <shashank.sharma@xxxxxxxxx> > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > --- > > drivers/gpu/drm/drm_edid.c | 151 ++++++++++++++++++++++++++++++++++++- > > 1 file changed, 149 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > > index b700fc075257..9f6996323efa 100644 > > --- a/drivers/gpu/drm/drm_edid.c > > +++ b/drivers/gpu/drm/drm_edid.c > > @@ -1376,6 +1376,149 @@ static const struct drm_display_mode edid_cea_modes_0[] = { > > .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > }; > > > > +/* > > + * From CEA/CTA-861 spec. > > + * > > + * Index with VIC-193. > > + */ > > +static const struct drm_display_mode edid_cea_modes_193[] = { > just like previous patch, should we call it edid_cea_861_g_modes ? > > + /* 193 - 5120x2160@120Hz 64:27 */ > > + { DRM_MODE("5120x2160", DRM_MODE_TYPE_DRIVER, 1485000, 5120, 5284, > > + 5372, 5500, 0, 2160, 2168, 2178, 2250, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 194 - 7680x4320@24Hz 16:9 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 10232, > > + 10408, 11000, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, > > + /* 195 - 7680x4320@25Hz 16:9 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 10032, > > + 10208, 10800, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, > > + /* 196 - 7680x4320@30Hz 16:9 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 8232, > > + 8408, 9000, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, > > + /* 197 - 7680x4320@48Hz 16:9 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 10232, > > + 10408, 11000, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 48, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, > > + /* 198 - 7680x4320@50Hz 16:9 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 10032, > > + 10208, 10800, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, > > + /* 199 - 7680x4320@60Hz 16:9 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 8232, > > + 8408, 9000, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, > > + /* 200 - 7680x4320@100Hz 16:9 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 4752000, 7680, 9792, > > + 9968, 10560, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, > > + /* 201 - 7680x4320@120Hz 16:9 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 4752000, 7680, 8032, > > + 8208, 8800, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, > > + /* 202 - 7680x4320@24Hz 64:27 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 10232, > > + 10408, 11000, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 203 - 7680x4320@25Hz 64:27 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 10032, > > + 10208, 10800, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 204 - 7680x4320@30Hz 64:27 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 8232, > > + 8408, 9000, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 205 - 7680x4320@48Hz 64:27 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 10232, > > + 10408, 11000, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 48, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 206 - 7680x4320@50Hz 64:27 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 10032, > > + 10208, 10800, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 207 - 7680x4320@60Hz 64:27 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 8232, > > + 8408, 9000, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 208 - 7680x4320@100Hz 64:27 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 4752000, 7680, 9792, > > + 9968, 10560, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 209 - 7680x4320@120Hz 64:27 */ > > + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 4752000, 7680, 8032, > > + 8208, 8800, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 210 - 10240x4320@24Hz 64:27 */ > > + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 1485000, 10240, 11732, > > + 11908, 12500, 0, 4320, 4336, 4356, 4950, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 211 - 10240x4320@25Hz 64:27 */ > > + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 1485000, 10240, 12732, > > + 12908, 13500, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 212 - 10240x4320@30Hz 64:27 */ > > + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 1485000, 10240, 10528, > > + 10704, 11000, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 213 - 10240x4320@48Hz 64:27 */ > > + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 2970000, 10240, 11732, > > + 11908, 12500, 0, 4320, 4336, 4356, 4950, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 48, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 214 - 10240x4320@50Hz 64:27 */ > > + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 2970000, 10240, 12732, > > + 12908, 13500, 0, 4320, 4336, 4356, 4400, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 215 - 10240x4320@60Hz 64:27 */ > > + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 2970000, 10240, 10528, > > + 10704, 11000, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 216 - 10240x4320@100Hz 64:27 */ > > + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 5940000, 10240, 12432, > > + 12608, 13200, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 217 - 10240x4320@120Hz 64:27 */ > > + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 5940000, 10240, 10528, > > + 10704, 11000, 0, 4320, 4336, 4356, 4500, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, > > + /* 218 - 4096x2160@100Hz 256:135 */ > > + { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 1188000, 4096, 4896, > > + 4984, 5280, 0, 2160, 2168, 2178, 2250, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135, }, > > + /* 219 - 4096x2160@120Hz 256:135 */ > > + { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 1188000, 4096, 4184, > > + 4272, 4400, 0, 2160, 2168, 2178, 2250, 0, > > + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), > > + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135, }, > > +}; > > + > > /* > > * HDMI 1.4 4k modes. Index using the VIC. > > */ > > @@ -3072,17 +3215,21 @@ static const struct drm_display_mode *cea_mode_for_vic(u8 vic) > > return NULL; > > if (vic < ARRAY_SIZE(edid_cea_modes_0)) > > return &edid_cea_modes_0[vic]; > > + if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193)) > > + return &edid_cea_modes_193[vic - 193]; > > return NULL; > > } > > > > static u8 cea_num_vics(void) > > { > > - return ARRAY_SIZE(edid_cea_modes_0); > > + return 193 + ARRAY_SIZE(edid_cea_modes_193); > Now that we are planning to remove the dummy mode index at 0, shouldn't > this be 192 + ARRAY_SZ(), as this array starts from VIC 193 ? No. This just returns the <last VIC we have a definition for>+1. If that definition happens to be stored in foo[ARRAY_SIZE(foo)-1] and foo[0] == <definition for VIC 193> and there is no extra junk in the middle of foo[] then the answer should be 193+ARRAY_SIZE(foo). > > } > > > > static u8 cea_next_vic(u8 vic) > > { > > - return vic + 1; > > + if (++vic == ARRAY_SIZE(edid_cea_modes_0)) > > + vic = 193; > > Ok, this explains why separate function for next vic :) > > - Shashank > > > + return vic; > > } > > > > /* -- Ville Syrjälä Intel _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel