On 29-07-21, 23:54, Dmitry Baryshkov wrote: > On 15/07/2021 09:52, Vinod Koul wrote: > > diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > > index 8d942052db8a..41140b781e66 100644 > > --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > > +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c > > @@ -21,12 +21,17 @@ > > #include "dpu_hw_intf.h" > > #include "dpu_hw_ctl.h" > > #include "dpu_hw_dspp.h" > > +#include "dpu_hw_dsc.h" > > #include "dpu_formats.h" > > #include "dpu_encoder_phys.h" > > #include "dpu_crtc.h" > > #include "dpu_trace.h" > > #include "dpu_core_irq.h" > > +#define DSC_MODE_SPLIT_PANEL BIT(0) > > +#define DSC_MODE_MULTIPLEX BIT(1) > > +#define DSC_MODE_VIDEO BIT(2) > > This should go into dpu_hw_dsc.h. Ah. They are already defined there and > just redefined there. Remove the defines here. Sure, updated > It might be cleaner to add bool flags to struct msm_display_dsc_config and > then calculate common mode in the dpu_hw_dsc_config(). How would that be better than calculating here? I dont see much of an advantage. > > +static void dpu_encoder_dsc_pipe_cfg(struct dpu_hw_dsc *hw_dsc, > > + struct dpu_hw_pingpong *hw_pp, > > + struct msm_display_dsc_config *dsc, > > + u32 common_mode) > > +{ > > + if (hw_dsc->ops.dsc_config) > > + hw_dsc->ops.dsc_config(hw_dsc, dsc, common_mode); > > + > > + if (hw_dsc->ops.dsc_config_thresh) > > + hw_dsc->ops.dsc_config_thresh(hw_dsc, dsc); > > + > > + if (hw_pp->ops.setup_dsc) > > + hw_pp->ops.setup_dsc(hw_pp); > > + > > + if (hw_pp->ops.enable_dsc) > > + hw_pp->ops.enable_dsc(hw_pp); > > I think, we do not need to split these operations, I'd suggest having just > hw_dsc->ops.dsc_config() and hw_pp->ops.enable_dsc(), merging > dsc_config_thres() and setup_dsc() into respective methods. Merging hw_dsc->ops.dsc_config() and hw_dsc->ops.dsc_config_thresh() would make it from L to XL size, so lets keep them split. We could merge the small hw_pp->ops.setup_dsc() and hw_pp->ops.enable_dsc() though. > > void dpu_encoder_prepare_for_kickoff(struct drm_encoder *drm_enc) > > { > > struct dpu_encoder_virt *dpu_enc; > > struct dpu_encoder_phys *phys; > > + struct msm_drm_private *priv; > > bool needs_hw_reset = false; > > unsigned int i; > > @@ -1841,6 +1977,10 @@ void dpu_encoder_prepare_for_kickoff(struct drm_encoder *drm_enc) > > dpu_encoder_helper_hw_reset(dpu_enc->phys_encs[i]); > > } > > } > > + > > + priv = drm_enc->dev->dev_private; > > + if (priv->dsc) > > + dpu_encoder_prep_dsc(dpu_enc, priv->dsc); > > Not quite. This makes dsc config global, while we can have several encoders > enabled at once (think of DSI + DP). So the dsc should be a per-encoder > setting rather than global. I agree it would make sense to have per-encoder. The DP part needs to be comprehended for DSC and would need more changes. I think updating this for DP then and making it generic as required for DP would be better, right? In that case I will skip moving to encoder for now. -- ~Vinod