Dmitry Baryshkov
2024-Nov-17 23:55 UTC
[PATCH 1/5] drm/encoder_slave: make mode_valid accept const struct drm_display_mode
On Mon, 18 Nov 2024 at 01:33, Laurent Pinchart <laurent.pinchart at ideasonboard.com> wrote:> > On Mon, Nov 18, 2024 at 01:22:12AM +0200, Dmitry Baryshkov wrote: > > On Sun, 17 Nov 2024 at 22:54, Laurent Pinchart wrote: > > > On Fri, Nov 15, 2024 at 11:09:26PM +0200, Dmitry Baryshkov wrote: > > > > The mode_valid() callbacks of drm_encoder, drm_crtc and drm_bridge > > > > accept const struct drm_display_mode argument. Change the mode_valid > > > > callback of drm_encoder_slave to also accept const argument. > > > > > > > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org> > > > > > > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com> > > > > > > On a side note, there's only two I2C slave encoder drivers left... I > > > wonder if we could so something about them. The ch7006 and sil164 > > > drivers seem to be used by nouveau only, could they be moved to > > > drivers/gpu/drm/nouveau/ ? We would move the whole drm_encoder_slave > > > implementation there too, and leave it to die (or get taken out of limbo > > > and fixed) with dispnv04. > > > > Or it might be better to switch to drm_bridge. Currently we also have > > sil164 (sub)drivers in ast and i915 drivers. I don't know if there is > > any common code to share or not. If there is some, it might be nice to > > use common framework. > > That would require porting nouveau and i915 to drm_bridge. As much as > I'd love to see that happening, I won't hold my breath.Me neither. Probably moving those two and drm_encoder_slave to nouveau is really the best course for now.> > > > > --- > > > > drivers/gpu/drm/i2c/ch7006_drv.c | 2 +- > > > > drivers/gpu/drm/i2c/sil164_drv.c | 2 +- > > > > drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | 2 +- > > > > include/drm/drm_encoder_slave.h | 2 +- > > > > 4 files changed, 4 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c > > > > index 131512a5f3bd996ad1e2eb869ffa09837daba0c7..a57f0a41c1a9e2006142fe0bad2914b0c344c82a 100644 > > > > --- a/drivers/gpu/drm/i2c/ch7006_drv.c > > > > +++ b/drivers/gpu/drm/i2c/ch7006_drv.c > > > > @@ -104,7 +104,7 @@ static bool ch7006_encoder_mode_fixup(struct drm_encoder *encoder, > > > > } > > > > > > > > static int ch7006_encoder_mode_valid(struct drm_encoder *encoder, > > > > - struct drm_display_mode *mode) > > > > + const struct drm_display_mode *mode) > > > > { > > > > if (ch7006_lookup_mode(encoder, mode)) > > > > return MODE_OK; > > > > diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c > > > > index ff23422727fce290a188e495d343e32bc2c373ec..708e119072fcb50c31b5596b75dc341429b93697 100644 > > > > --- a/drivers/gpu/drm/i2c/sil164_drv.c > > > > +++ b/drivers/gpu/drm/i2c/sil164_drv.c > > > > @@ -255,7 +255,7 @@ sil164_encoder_restore(struct drm_encoder *encoder) > > > > > > > > static int > > > > sil164_encoder_mode_valid(struct drm_encoder *encoder, > > > > - struct drm_display_mode *mode) > > > > + const struct drm_display_mode *mode) > > > > { > > > > struct sil164_priv *priv = to_sil164_priv(encoder); > > > > > > > > diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c > > > > index 3ecb101d23e949b753b873d24eec01ad6fe7f5d6..35ad4e10d27323c87704a3ff35b7dc26462c82bd 100644 > > > > --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c > > > > +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c > > > > @@ -308,7 +308,7 @@ static int nv17_tv_get_modes(struct drm_encoder *encoder, > > > > } > > > > > > > > static int nv17_tv_mode_valid(struct drm_encoder *encoder, > > > > - struct drm_display_mode *mode) > > > > + const struct drm_display_mode *mode) > > > > { > > > > struct nv17_tv_norm_params *tv_norm = get_tv_norm(encoder); > > > > > > > > diff --git a/include/drm/drm_encoder_slave.h b/include/drm/drm_encoder_slave.h > > > > index 49172166a164474f43e4afb2eeeb3cde8ae7c61a..b526643833dcf78bae29f9fbbe27de3f730b55d8 100644 > > > > --- a/include/drm/drm_encoder_slave.h > > > > +++ b/include/drm/drm_encoder_slave.h > > > > @@ -85,7 +85,7 @@ struct drm_encoder_slave_funcs { > > > > * @mode_valid: Analogous to &drm_encoder_helper_funcs @mode_valid. > > > > */ > > > > int (*mode_valid)(struct drm_encoder *encoder, > > > > - struct drm_display_mode *mode); > > > > + const struct drm_display_mode *mode); > > > > /** > > > > * @mode_set: Analogous to &drm_encoder_helper_funcs @mode_set > > > > * callback. Wrapped by drm_i2c_encoder_mode_set(). > > > > > > -- > Regards, > > Laurent Pinchart-- With best wishes Dmitry
Jani Nikula
2024-Nov-18 09:26 UTC
[PATCH 1/5] drm/encoder_slave: make mode_valid accept const struct drm_display_mode
On Mon, 18 Nov 2024, Dmitry Baryshkov <dmitry.baryshkov at linaro.org> wrote:> On Mon, 18 Nov 2024 at 01:33, Laurent Pinchart > <laurent.pinchart at ideasonboard.com> wrote: >> >> On Mon, Nov 18, 2024 at 01:22:12AM +0200, Dmitry Baryshkov wrote: >> > On Sun, 17 Nov 2024 at 22:54, Laurent Pinchart wrote: >> > > On Fri, Nov 15, 2024 at 11:09:26PM +0200, Dmitry Baryshkov wrote: >> > > > The mode_valid() callbacks of drm_encoder, drm_crtc and drm_bridge >> > > > accept const struct drm_display_mode argument. Change the mode_valid >> > > > callback of drm_encoder_slave to also accept const argument. >> > > > >> > > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org> >> > > >> > > Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas at ideasonboard.com> >> > > >> > > On a side note, there's only two I2C slave encoder drivers left... I >> > > wonder if we could so something about them. The ch7006 and sil164 >> > > drivers seem to be used by nouveau only, could they be moved to >> > > drivers/gpu/drm/nouveau/ ? We would move the whole drm_encoder_slave >> > > implementation there too, and leave it to die (or get taken out of limbo >> > > and fixed) with dispnv04. >> > >> > Or it might be better to switch to drm_bridge. Currently we also have >> > sil164 (sub)drivers in ast and i915 drivers. I don't know if there is >> > any common code to share or not. If there is some, it might be nice to >> > use common framework. >> >> That would require porting nouveau and i915 to drm_bridge. As much as >> I'd love to see that happening, I won't hold my breath. > > Me neither. Probably moving those two and drm_encoder_slave to nouveau > is really the best course for now.Granted, the dvo part of i915 is ugly, but it's also only relevant for the oldest hardware i915 supports. Like 20 years old. Not sure there's much return on investment in big refactoring, more risk that it breaks without nobody noticing. Just let it be in i915? BR, Jani. -- Jani Nikula, Intel