Message ID | 20190903165227.6056-2-shashank.sharma@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Enable Nearest-neighbor for Integer mode scaling | expand |
On Tue, 03 Sep 2019, Shashank Sharma <shashank.sharma@intel.com> wrote: > If the upscaling ratio is a complete integer, Intel display HW can > pickup special scaling mode, which can produce better non-blurry > outputs. This patch adds a check to indicate if this is such an upscaling > opportunity, while calculating the scaler config, and stores it into scaler > state. > > Cc: Jani Nikula <jani.nikula@intel.com> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> > Cc: Daniel Vetter <daniel.vetter@intel.com> > Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com> > Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> > --- > drivers/gpu/drm/i915/display/intel_display.c | 21 +++++++++++++++++++ > .../drm/i915/display/intel_display_types.h | 7 +++++++ > 2 files changed, 28 insertions(+) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index ee54d9659c99..613130db3c05 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited) > #define SKL_MIN_YUV_420_SRC_W 16 > #define SKL_MIN_YUV_420_SRC_H 16 > > +static inline bool Please don't add superfluous inlines to static functions in .c files. Let the compiler do its job. BR, Jani. > +scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h) > +{ > + /* Integer mode scaling is applicable only for upscaling scenarios */ > + if (dst_w < src_w || dst_h < src_h) > + return false; > + > + if (dst_w % src_w == 0 && dst_h % src_h == 0) > + return true; > + > + return false; > +} > + > static int > skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, > unsigned int scaler_user, int *scaler_id, > @@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, > return -EINVAL; > } > > + /* > + * If we are upscaling, and the scaling ratios are integer, we can > + * pick nearest-neighbour method in HW for scaling, which produces > + * blurless outputs in such scenarios. > + */ > + if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h)) > + scaler_state->integer_scaling = true; > + > /* > * if plane is being disabled or scaler is no more required or force detach > * - free scaler binded to this plane/crtc > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h > index 3c1a5f3e1d22..6bb32fbf3153 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_types.h > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h > @@ -613,6 +613,13 @@ struct intel_crtc_scaler_state { > > /* scaler used by crtc for panel fitting purpose */ > int scaler_id; > + > + /* > + * Nearest-neighbor method of upscaling gieves blurless output if > + * the upscaling ratio is a complete integer. This bool is to indicate > + * such an opportunity. > + */ > + bool integer_scaling; > }; > > /* drm_mode->private_flags */
On 2019-09-03 at 22:22:26 +0530, Shashank Sharma wrote: > If the upscaling ratio is a complete integer, Intel display HW can > pickup special scaling mode, which can produce better non-blurry > outputs. This patch adds a check to indicate if this is such an upscaling > opportunity, while calculating the scaler config, and stores it into scaler > state. > > Cc: Jani Nikula <jani.nikula@intel.com> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> > Cc: Daniel Vetter <daniel.vetter@intel.com> > Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com> > Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> > --- > drivers/gpu/drm/i915/display/intel_display.c | 21 +++++++++++++++++++ > .../drm/i915/display/intel_display_types.h | 7 +++++++ > 2 files changed, 28 insertions(+) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index ee54d9659c99..613130db3c05 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited) > #define SKL_MIN_YUV_420_SRC_W 16 > #define SKL_MIN_YUV_420_SRC_H 16 > > +static inline bool > +scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h) Just a suggestion: scaling_ratio_is_integer() might sound better here!? > +{ > + /* Integer mode scaling is applicable only for upscaling scenarios */ > + if (dst_w < src_w || dst_h < src_h) > + return false; > + > + if (dst_w % src_w == 0 && dst_h % src_h == 0) > + return true; > + > + return false; > +} > + > static int > skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, > unsigned int scaler_user, int *scaler_id, > @@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, > return -EINVAL; > } > > + /* > + * If we are upscaling, and the scaling ratios are integer, we can > + * pick nearest-neighbour method in HW for scaling, which produces > + * blurless outputs in such scenarios. > + */ > + if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h)) > + scaler_state->integer_scaling = true; > + > /* > * if plane is being disabled or scaler is no more required or force detach > * - free scaler binded to this plane/crtc > diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h > index 3c1a5f3e1d22..6bb32fbf3153 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_types.h > +++ b/drivers/gpu/drm/i915/display/intel_display_types.h > @@ -613,6 +613,13 @@ struct intel_crtc_scaler_state { > > /* scaler used by crtc for panel fitting purpose */ > int scaler_id; > + > + /* > + * Nearest-neighbor method of upscaling gieves blurless output if Typo: Gives. -Ram > + * the upscaling ratio is a complete integer. This bool is to indicate > + * such an opportunity. > + */ > + bool integer_scaling; > }; > > /* drm_mode->private_flags */ > -- > 2.17.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On 9/4/2019 12:58 PM, Jani Nikula wrote: > On Tue, 03 Sep 2019, Shashank Sharma <shashank.sharma@intel.com> wrote: >> If the upscaling ratio is a complete integer, Intel display HW can >> pickup special scaling mode, which can produce better non-blurry >> outputs. This patch adds a check to indicate if this is such an upscaling >> opportunity, while calculating the scaler config, and stores it into scaler >> state. >> >> Cc: Jani Nikula <jani.nikula@intel.com> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> >> Cc: Daniel Vetter <daniel.vetter@intel.com> >> Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com> >> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> >> --- >> drivers/gpu/drm/i915/display/intel_display.c | 21 +++++++++++++++++++ >> .../drm/i915/display/intel_display_types.h | 7 +++++++ >> 2 files changed, 28 insertions(+) >> >> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c >> index ee54d9659c99..613130db3c05 100644 >> --- a/drivers/gpu/drm/i915/display/intel_display.c >> +++ b/drivers/gpu/drm/i915/display/intel_display.c >> @@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited) >> #define SKL_MIN_YUV_420_SRC_W 16 >> #define SKL_MIN_YUV_420_SRC_H 16 >> >> +static inline bool > Please don't add superfluous inlines to static functions in .c > files. Let the compiler do its job. Sure, got it ! > BR, > Jani. > >> +scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h) >> +{ >> + /* Integer mode scaling is applicable only for upscaling scenarios */ >> + if (dst_w < src_w || dst_h < src_h) >> + return false; >> + >> + if (dst_w % src_w == 0 && dst_h % src_h == 0) >> + return true; >> + >> + return false; >> +} >> + >> static int >> skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, >> unsigned int scaler_user, int *scaler_id, >> @@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, >> return -EINVAL; >> } >> >> + /* >> + * If we are upscaling, and the scaling ratios are integer, we can >> + * pick nearest-neighbour method in HW for scaling, which produces >> + * blurless outputs in such scenarios. >> + */ >> + if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h)) >> + scaler_state->integer_scaling = true; >> + >> /* >> * if plane is being disabled or scaler is no more required or force detach >> * - free scaler binded to this plane/crtc >> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h >> index 3c1a5f3e1d22..6bb32fbf3153 100644 >> --- a/drivers/gpu/drm/i915/display/intel_display_types.h >> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h >> @@ -613,6 +613,13 @@ struct intel_crtc_scaler_state { >> >> /* scaler used by crtc for panel fitting purpose */ >> int scaler_id; >> + >> + /* >> + * Nearest-neighbor method of upscaling gieves blurless output if >> + * the upscaling ratio is a complete integer. This bool is to indicate >> + * such an opportunity. >> + */ >> + bool integer_scaling; >> }; >> >> /* drm_mode->private_flags */
On 9/4/2019 1:08 PM, Ramalingam C wrote: > On 2019-09-03 at 22:22:26 +0530, Shashank Sharma wrote: >> If the upscaling ratio is a complete integer, Intel display HW can >> pickup special scaling mode, which can produce better non-blurry >> outputs. This patch adds a check to indicate if this is such an upscaling >> opportunity, while calculating the scaler config, and stores it into scaler >> state. >> >> Cc: Jani Nikula <jani.nikula@intel.com> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> >> Cc: Daniel Vetter <daniel.vetter@intel.com> >> Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com> >> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> >> --- >> drivers/gpu/drm/i915/display/intel_display.c | 21 +++++++++++++++++++ >> .../drm/i915/display/intel_display_types.h | 7 +++++++ >> 2 files changed, 28 insertions(+) >> >> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c >> index ee54d9659c99..613130db3c05 100644 >> --- a/drivers/gpu/drm/i915/display/intel_display.c >> +++ b/drivers/gpu/drm/i915/display/intel_display.c >> @@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited) >> #define SKL_MIN_YUV_420_SRC_W 16 >> #define SKL_MIN_YUV_420_SRC_H 16 >> >> +static inline bool >> +scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h) > Just a suggestion: scaling_ratio_is_integer() might sound better here!? Agree, certainly sounds better. >> +{ >> + /* Integer mode scaling is applicable only for upscaling scenarios */ >> + if (dst_w < src_w || dst_h < src_h) >> + return false; >> + >> + if (dst_w % src_w == 0 && dst_h % src_h == 0) >> + return true; >> + >> + return false; >> +} >> + >> static int >> skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, >> unsigned int scaler_user, int *scaler_id, >> @@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, >> return -EINVAL; >> } >> >> + /* >> + * If we are upscaling, and the scaling ratios are integer, we can >> + * pick nearest-neighbour method in HW for scaling, which produces >> + * blurless outputs in such scenarios. >> + */ >> + if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h)) >> + scaler_state->integer_scaling = true; >> + >> /* >> * if plane is being disabled or scaler is no more required or force detach >> * - free scaler binded to this plane/crtc >> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h >> index 3c1a5f3e1d22..6bb32fbf3153 100644 >> --- a/drivers/gpu/drm/i915/display/intel_display_types.h >> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h >> @@ -613,6 +613,13 @@ struct intel_crtc_scaler_state { >> >> /* scaler used by crtc for panel fitting purpose */ >> int scaler_id; >> + >> + /* >> + * Nearest-neighbor method of upscaling gieves blurless output if > Typo: Gives. got it. > > -Ram >> + * the upscaling ratio is a complete integer. This bool is to indicate >> + * such an opportunity. >> + */ >> + bool integer_scaling; >> }; >> >> /* drm_mode->private_flags */ >> -- >> 2.17.1 >> >> _______________________________________________ >> Intel-gfx mailing list >> Intel-gfx@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index ee54d9659c99..613130db3c05 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -5388,6 +5388,19 @@ u16 skl_scaler_calc_phase(int sub, int scale, bool chroma_cosited) #define SKL_MIN_YUV_420_SRC_W 16 #define SKL_MIN_YUV_420_SRC_H 16 +static inline bool +scaling_ratio_integer(int src_w, int dst_w, int src_h, int dst_h) +{ + /* Integer mode scaling is applicable only for upscaling scenarios */ + if (dst_w < src_w || dst_h < src_h) + return false; + + if (dst_w % src_w == 0 && dst_h % src_h == 0) + return true; + + return false; +} + static int skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, unsigned int scaler_user, int *scaler_id, @@ -5422,6 +5435,14 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, return -EINVAL; } + /* + * If we are upscaling, and the scaling ratios are integer, we can + * pick nearest-neighbour method in HW for scaling, which produces + * blurless outputs in such scenarios. + */ + if (scaling_ratio_integer(src_w, dst_w, src_h, dst_h)) + scaler_state->integer_scaling = true; + /* * if plane is being disabled or scaler is no more required or force detach * - free scaler binded to this plane/crtc diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 3c1a5f3e1d22..6bb32fbf3153 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -613,6 +613,13 @@ struct intel_crtc_scaler_state { /* scaler used by crtc for panel fitting purpose */ int scaler_id; + + /* + * Nearest-neighbor method of upscaling gieves blurless output if + * the upscaling ratio is a complete integer. This bool is to indicate + * such an opportunity. + */ + bool integer_scaling; }; /* drm_mode->private_flags */
If the upscaling ratio is a complete integer, Intel display HW can pickup special scaling mode, which can produce better non-blurry outputs. This patch adds a check to indicate if this is such an upscaling opportunity, while calculating the scaler config, and stores it into scaler state. Cc: Jani Nikula <jani.nikula@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Daniel Vetter <daniel.vetter@intel.com> Cc: Vivi, Rodrigo <rodrigo.vivi@intel.com> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> --- drivers/gpu/drm/i915/display/intel_display.c | 21 +++++++++++++++++++ .../drm/i915/display/intel_display_types.h | 7 +++++++ 2 files changed, 28 insertions(+)