Hi, On Wed, Jun 06, 2018 at 12:36:48PM +0300, Laurent Pinchart wrote: > The CRTC mode set implementation needs to access the omap_dss_device for > the pipeline display. To do so, it iterates over all pipelines to find > the one that contains an encoder corresponding to the CRTC, and request > the display device from the encoder. That's a very complicated dance > when the CRTC has a direct pipeline pointer already, and the pipeline > contains a pointer to the display device. > > Replace the convoluted code with direct access. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > --- Reviewed-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxxxx> -- Sebastian > drivers/gpu/drm/omapdrm/omap_crtc.c | 25 ++++--------------------- > drivers/gpu/drm/omapdrm/omap_encoder.c | 7 ------- > drivers/gpu/drm/omapdrm/omap_encoder.h | 3 --- > 3 files changed, 4 insertions(+), 31 deletions(-) > > diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c > index 197d05312306..6e7a777907f5 100644 > --- a/drivers/gpu/drm/omapdrm/omap_crtc.c > +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c > @@ -419,12 +419,12 @@ static enum drm_mode_status omap_crtc_mode_valid(struct drm_crtc *crtc, > static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc) > { > struct omap_crtc *omap_crtc = to_omap_crtc(crtc); > + struct omap_dss_device *display = omap_crtc->pipe->display; > struct drm_display_mode *mode = &crtc->state->adjusted_mode; > - struct omap_drm_private *priv = crtc->dev->dev_private; > const u32 flags_mask = DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_DE_LOW | > DISPLAY_FLAGS_PIXDATA_POSEDGE | DISPLAY_FLAGS_PIXDATA_NEGEDGE | > DISPLAY_FLAGS_SYNC_POSEDGE | DISPLAY_FLAGS_SYNC_NEGEDGE; > - unsigned int i; > + struct videomode vm = {0}; > > DBG("%s: set mode: %d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x", > omap_crtc->name, mode->base.id, mode->name, > @@ -447,25 +447,8 @@ static void omap_crtc_mode_set_nofb(struct drm_crtc *crtc) > * has been changed to the DRM model. > */ > > - for (i = 0; i < priv->num_pipes; ++i) { > - struct drm_encoder *encoder = priv->pipes[i].encoder; > - > - if (encoder->crtc == crtc) { > - struct omap_dss_device *dssdev; > - > - dssdev = omap_encoder_get_dssdev(encoder); > - > - if (dssdev) { > - struct videomode vm = {0}; > - > - dssdev->ops->get_timings(dssdev, &vm); > - > - omap_crtc->vm.flags |= vm.flags & flags_mask; > - } > - > - break; > - } > - } > + display->ops->get_timings(display, &vm); > + omap_crtc->vm.flags |= vm.flags & flags_mask; > } > > static int omap_crtc_atomic_check(struct drm_crtc *crtc, > diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.c b/drivers/gpu/drm/omapdrm/omap_encoder.c > index 7bbf3700e393..87e2b3799a45 100644 > --- a/drivers/gpu/drm/omapdrm/omap_encoder.c > +++ b/drivers/gpu/drm/omapdrm/omap_encoder.c > @@ -39,13 +39,6 @@ struct omap_encoder { > struct omap_dss_device *dssdev; > }; > > -struct omap_dss_device *omap_encoder_get_dssdev(struct drm_encoder *encoder) > -{ > - struct omap_encoder *omap_encoder = to_omap_encoder(encoder); > - > - return omap_encoder->dssdev; > -} > - > static void omap_encoder_destroy(struct drm_encoder *encoder) > { > struct omap_encoder *omap_encoder = to_omap_encoder(encoder); > diff --git a/drivers/gpu/drm/omapdrm/omap_encoder.h b/drivers/gpu/drm/omapdrm/omap_encoder.h > index d2f308bec494..e8f1a35dce2f 100644 > --- a/drivers/gpu/drm/omapdrm/omap_encoder.h > +++ b/drivers/gpu/drm/omapdrm/omap_encoder.h > @@ -27,7 +27,4 @@ struct omap_dss_device; > struct drm_encoder *omap_encoder_init(struct drm_device *dev, > struct omap_dss_device *dssdev); > > -/* map crtc to vblank mask */ > -struct omap_dss_device *omap_encoder_get_dssdev(struct drm_encoder *encoder); > - > #endif /* __OMAPDRM_ENCODER_H__ */ > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > dri-devel mailing list > dri-devel@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/dri-devel
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel