Message ID | 20190925135502.24055-4-ville.syrjala@linux.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/edid: Add new modes from CTA-861-G | expand |
On 9/25/2019 7:25 PM, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Now that the cea mode handling is not 100% tied to the single > array the dummy VIC 0 mode is pretty much pointles. Throw it > out. > > Cc: Hans Verkuil <hansverk@cisco.com> > Cc: Shashank Sharma <shashank.sharma@intel.com> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/gpu/drm/drm_edid.c | 14 +++++--------- > 1 file changed, 5 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 9f6996323efa..0007004d3221 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -709,11 +709,9 @@ static const struct minimode extra_modes[] = { > /* > * From CEA/CTA-861 spec. > * > - * Index with VIC. > + * Index with VIC-1. Do we want to really do this ? Till now, due to dummy VIC, indexing was pretty direct as per VIC, which was making the code easy to read and understand. I would still think that keeping the dummy VIC and adjusting the size of cea_modes_0[] in the size function, would be something neater to do, do you think so ? - Shashank > */ > -static const struct drm_display_mode edid_cea_modes_0[] = { > - /* 0 - dummy, VICs start at 1 */ > - { }, > +static const struct drm_display_mode edid_cea_modes_1[] = { > /* 1 - 640x480@60Hz 4:3 */ > { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656, > 752, 800, 0, 480, 490, 492, 525, 0, > @@ -3211,10 +3209,8 @@ static u8 *drm_find_cea_extension(const struct edid *edid) > > static const struct drm_display_mode *cea_mode_for_vic(u8 vic) > { > - if (!vic) > - return NULL; > - if (vic < ARRAY_SIZE(edid_cea_modes_0)) > - return &edid_cea_modes_0[vic]; > + if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1)) > + return &edid_cea_modes_1[vic - 1]; > if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193)) > return &edid_cea_modes_193[vic - 193]; > return NULL; > @@ -3227,7 +3223,7 @@ static u8 cea_num_vics(void) > > static u8 cea_next_vic(u8 vic) > { > - if (++vic == ARRAY_SIZE(edid_cea_modes_0)) > + if (++vic == 1 + ARRAY_SIZE(edid_cea_modes_1)) > vic = 193; > return vic; > }
On Thu, Oct 03, 2019 at 01:59:42PM +0530, Sharma, Shashank wrote: > > On 9/25/2019 7:25 PM, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > Now that the cea mode handling is not 100% tied to the single > > array the dummy VIC 0 mode is pretty much pointles. Throw it > > out. > > > > Cc: Hans Verkuil <hansverk@cisco.com> > > Cc: Shashank Sharma <shashank.sharma@intel.com> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > --- > > drivers/gpu/drm/drm_edid.c | 14 +++++--------- > > 1 file changed, 5 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > > index 9f6996323efa..0007004d3221 100644 > > --- a/drivers/gpu/drm/drm_edid.c > > +++ b/drivers/gpu/drm/drm_edid.c > > @@ -709,11 +709,9 @@ static const struct minimode extra_modes[] = { > > /* > > * From CEA/CTA-861 spec. > > * > > - * Index with VIC. > > + * Index with VIC-1. > > Do we want to really do this ? Till now, due to dummy VIC, indexing was > pretty direct as per VIC, which was making the code easy to read and > understand. I would still think that keeping the dummy VIC and adjusting > the size of cea_modes_0[] in the size function, would be something > neater to do, do you think so ? I don't see the point of wasting that space. The access is now fully abstraced so you *never* index this directly. > > - Shashank > > > */ > > -static const struct drm_display_mode edid_cea_modes_0[] = { > > - /* 0 - dummy, VICs start at 1 */ > > - { }, > > +static const struct drm_display_mode edid_cea_modes_1[] = { > > /* 1 - 640x480@60Hz 4:3 */ > > { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656, > > 752, 800, 0, 480, 490, 492, 525, 0, > > @@ -3211,10 +3209,8 @@ static u8 *drm_find_cea_extension(const struct edid *edid) > > > > static const struct drm_display_mode *cea_mode_for_vic(u8 vic) > > { > > - if (!vic) > > - return NULL; > > - if (vic < ARRAY_SIZE(edid_cea_modes_0)) > > - return &edid_cea_modes_0[vic]; > > + if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1)) > > + return &edid_cea_modes_1[vic - 1]; > > if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193)) > > return &edid_cea_modes_193[vic - 193]; > > return NULL; > > @@ -3227,7 +3223,7 @@ static u8 cea_num_vics(void) > > > > static u8 cea_next_vic(u8 vic) > > { > > - if (++vic == ARRAY_SIZE(edid_cea_modes_0)) > > + if (++vic == 1 + ARRAY_SIZE(edid_cea_modes_1)) > > vic = 193; > > return vic; > > }
On Wed, Sep 25, 2019 at 04:55:01PM +0300, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > Now that the cea mode handling is not 100% tied to the single > array the dummy VIC 0 mode is pretty much pointles. Throw it > out. > > Cc: Hans Verkuil <hansverk@cisco.com> > Cc: Shashank Sharma <shashank.sharma@intel.com> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > --- > drivers/gpu/drm/drm_edid.c | 14 +++++--------- > 1 file changed, 5 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 9f6996323efa..0007004d3221 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -709,11 +709,9 @@ static const struct minimode extra_modes[] = { > /* > * From CEA/CTA-861 spec. > * > - * Index with VIC. > + * Index with VIC-1. Since we shouldn't be indexing into this array directly any more, this comment should instead be changed to say which functions should be used. > */ > -static const struct drm_display_mode edid_cea_modes_0[] = { > - /* 0 - dummy, VICs start at 1 */ > - { }, > +static const struct drm_display_mode edid_cea_modes_1[] = { > /* 1 - 640x480@60Hz 4:3 */ > { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656, > 752, 800, 0, 480, 490, 492, 525, 0, > @@ -3211,10 +3209,8 @@ static u8 *drm_find_cea_extension(const struct edid *edid) > > static const struct drm_display_mode *cea_mode_for_vic(u8 vic) > { > - if (!vic) > - return NULL; > - if (vic < ARRAY_SIZE(edid_cea_modes_0)) > - return &edid_cea_modes_0[vic]; > + if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1)) > + return &edid_cea_modes_1[vic - 1]; > if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193)) > return &edid_cea_modes_193[vic - 193]; > return NULL; > @@ -3227,7 +3223,7 @@ static u8 cea_num_vics(void) > > static u8 cea_next_vic(u8 vic) > { > - if (++vic == ARRAY_SIZE(edid_cea_modes_0)) > + if (++vic == 1 + ARRAY_SIZE(edid_cea_modes_1)) > vic = 193; > return vic; > }
On Tue, Dec 10, 2019 at 03:18:54PM -0800, Tom Anderson wrote: > On Wed, Sep 25, 2019 at 04:55:01PM +0300, Ville Syrjala wrote: > > From: Ville Syrjälä <ville.syrjala@linux.intel.com> > > > > Now that the cea mode handling is not 100% tied to the single > > array the dummy VIC 0 mode is pretty much pointles. Throw it > > out. > > > > Cc: Hans Verkuil <hansverk@cisco.com> > > Cc: Shashank Sharma <shashank.sharma@intel.com> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> > > --- > > drivers/gpu/drm/drm_edid.c | 14 +++++--------- > > 1 file changed, 5 insertions(+), 9 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > > index 9f6996323efa..0007004d3221 100644 > > --- a/drivers/gpu/drm/drm_edid.c > > +++ b/drivers/gpu/drm/drm_edid.c > > @@ -709,11 +709,9 @@ static const struct minimode extra_modes[] = { > > /* > > * From CEA/CTA-861 spec. > > * > > - * Index with VIC. > > + * Index with VIC-1. > > Since we shouldn't be indexing into this array directly any more, this comment > should instead be changed to say which functions should be used. Seems reasonable. > > > */ > > -static const struct drm_display_mode edid_cea_modes_0[] = { > > - /* 0 - dummy, VICs start at 1 */ > > - { }, > > +static const struct drm_display_mode edid_cea_modes_1[] = { > > /* 1 - 640x480@60Hz 4:3 */ > > { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656, > > 752, 800, 0, 480, 490, 492, 525, 0, > > @@ -3211,10 +3209,8 @@ static u8 *drm_find_cea_extension(const struct edid *edid) > > > > static const struct drm_display_mode *cea_mode_for_vic(u8 vic) > > { > > - if (!vic) > > - return NULL; > > - if (vic < ARRAY_SIZE(edid_cea_modes_0)) > > - return &edid_cea_modes_0[vic]; > > + if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1)) > > + return &edid_cea_modes_1[vic - 1]; > > if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193)) > > return &edid_cea_modes_193[vic - 193]; > > return NULL; > > @@ -3227,7 +3223,7 @@ static u8 cea_num_vics(void) > > > > static u8 cea_next_vic(u8 vic) > > { > > - if (++vic == ARRAY_SIZE(edid_cea_modes_0)) > > + if (++vic == 1 + ARRAY_SIZE(edid_cea_modes_1)) > > vic = 193; > > return vic; > > }
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 9f6996323efa..0007004d3221 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -709,11 +709,9 @@ static const struct minimode extra_modes[] = { /* * From CEA/CTA-861 spec. * - * Index with VIC. + * Index with VIC-1. */ -static const struct drm_display_mode edid_cea_modes_0[] = { - /* 0 - dummy, VICs start at 1 */ - { }, +static const struct drm_display_mode edid_cea_modes_1[] = { /* 1 - 640x480@60Hz 4:3 */ { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656, 752, 800, 0, 480, 490, 492, 525, 0, @@ -3211,10 +3209,8 @@ static u8 *drm_find_cea_extension(const struct edid *edid) static const struct drm_display_mode *cea_mode_for_vic(u8 vic) { - if (!vic) - return NULL; - if (vic < ARRAY_SIZE(edid_cea_modes_0)) - return &edid_cea_modes_0[vic]; + if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1)) + return &edid_cea_modes_1[vic - 1]; if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193)) return &edid_cea_modes_193[vic - 193]; return NULL; @@ -3227,7 +3223,7 @@ static u8 cea_num_vics(void) static u8 cea_next_vic(u8 vic) { - if (++vic == ARRAY_SIZE(edid_cea_modes_0)) + if (++vic == 1 + ARRAY_SIZE(edid_cea_modes_1)) vic = 193; return vic; }