mbox series

[RFC,0/5] Introduce drm scaling filter property

Message ID 20200225070545.4482-1-pankaj.laxminarayan.bharadiya@intel.com (mailing list archive)
Headers show
Series Introduce drm scaling filter property | expand

Message

Pankaj Bharadiya Feb. 25, 2020, 7:05 a.m. UTC
Integer scaling (IS) is a nearest-neighbor upscaling technique that
simply scales up the existing pixels by an integer (i.e., whole
number) multiplier. Nearest-neighbor (NN) interpolation works by
filling in the missing color values in the upscaled image with that of
the coordinate-mapped nearest source pixel value.

Both IS and NN preserve the clarity of the original image. In
contrast, traditional upscaling algorithms, such as bilinear or
bicubic interpolation, result in blurry upscaled images because they
employ interpolation techniques that smooth out the transition from
one pixel to another.  Therefore, integer scaling is particularly
useful for pixel art games that rely on sharp, blocky images to
deliver their distinctive look.

Many gaming communities have been asking for integer-mode scaling
support, some links and background:

https://software.intel.com/en-us/articles/integer-scaling-support-on-intel-graphics
http://tanalin.com/en/articles/lossless-scaling/
https://community.amd.com/thread/209107
https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002/feature-request-nonblurry-upscaling-at-integer-rat/

This patch series -
  - Introduces new scaling filter property to allow userspace to
    select  the driver's default scaling filter or Nearest-neighbor(NN)
    filter for scaling operations on crtc/plane.
  - Implements and enable integer scaling for i915

Userspace patch series link: TBD.

Thanks to Shashank for initiating this work. His initial RFC can be
found here [1]

[1] https://patchwork.freedesktop.org/patch/337082/

Modifications done in this series -
   - refactored code and incorporated initial review comments and
     added 2 scaling filter types (default and NN) to begin with.
   - added scaling filter property support for planes and new API
     helpers for drivers to setup this property.
   - rewrote code to enable integer scaling and NN filter for i915


Pankaj Bharadiya (5):
  drm: Introduce scaling filter property
  drm/drm-kms.rst: Add Scaling filter property documentation
  drm/i915: Enable scaling filter for plane and pipe
  drm/i915: Introduce scaling filter related registers and bit fields.
  drm/i915/display: Add Nearest-neighbor based integer scaling support

 Documentation/gpu/drm-kms.rst                |   6 ++
 drivers/gpu/drm/drm_atomic_uapi.c            |   8 ++
 drivers/gpu/drm/drm_crtc.c                   |  16 +++
 drivers/gpu/drm/drm_mode_config.c            |  13 +++
 drivers/gpu/drm/drm_plane.c                  |  35 +++++++
 drivers/gpu/drm/i915/display/intel_display.c | 100 ++++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_display.h |   2 +
 drivers/gpu/drm/i915/display/intel_sprite.c  |  32 ++++--
 drivers/gpu/drm/i915/i915_reg.h              |  21 ++++
 include/drm/drm_crtc.h                       |  10 ++
 include/drm/drm_mode_config.h                |   6 ++
 include/drm/drm_plane.h                      |  14 +++
 12 files changed, 252 insertions(+), 11 deletions(-)

Comments

Ville Syrjala March 12, 2020, 2:04 p.m. UTC | #1
On Tue, Feb 25, 2020 at 12:35:40PM +0530, Pankaj Bharadiya wrote:
> Integer scaling (IS) is a nearest-neighbor upscaling technique that
> simply scales up the existing pixels by an integer (i.e., whole
> number) multiplier. Nearest-neighbor (NN) interpolation works by
> filling in the missing color values in the upscaled image with that of
> the coordinate-mapped nearest source pixel value.
> 
> Both IS and NN preserve the clarity of the original image. In
> contrast, traditional upscaling algorithms, such as bilinear or
> bicubic interpolation, result in blurry upscaled images because they
> employ interpolation techniques that smooth out the transition from
> one pixel to another.  Therefore, integer scaling is particularly
> useful for pixel art games that rely on sharp, blocky images to
> deliver their distinctive look.
> 
> Many gaming communities have been asking for integer-mode scaling
> support, some links and background:
> 
> https://software.intel.com/en-us/articles/integer-scaling-support-on-intel-graphics
> http://tanalin.com/en/articles/lossless-scaling/
> https://community.amd.com/thread/209107
> https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002/feature-request-nonblurry-upscaling-at-integer-rat/
> 
> This patch series -
>   - Introduces new scaling filter property to allow userspace to
>     select  the driver's default scaling filter or Nearest-neighbor(NN)
>     filter for scaling operations on crtc/plane.
>   - Implements and enable integer scaling for i915
> 
> Userspace patch series link: TBD.

That needs to be done or this will go nowhere.

> 
> Thanks to Shashank for initiating this work. His initial RFC can be
> found here [1]
> 
> [1] https://patchwork.freedesktop.org/patch/337082/
> 
> Modifications done in this series -
>    - refactored code and incorporated initial review comments and
>      added 2 scaling filter types (default and NN) to begin with.
>    - added scaling filter property support for planes and new API
>      helpers for drivers to setup this property.
>    - rewrote code to enable integer scaling and NN filter for i915
> 
> 
> Pankaj Bharadiya (5):
>   drm: Introduce scaling filter property
>   drm/drm-kms.rst: Add Scaling filter property documentation
>   drm/i915: Enable scaling filter for plane and pipe
>   drm/i915: Introduce scaling filter related registers and bit fields.
>   drm/i915/display: Add Nearest-neighbor based integer scaling support
> 
>  Documentation/gpu/drm-kms.rst                |   6 ++
>  drivers/gpu/drm/drm_atomic_uapi.c            |   8 ++
>  drivers/gpu/drm/drm_crtc.c                   |  16 +++
>  drivers/gpu/drm/drm_mode_config.c            |  13 +++
>  drivers/gpu/drm/drm_plane.c                  |  35 +++++++
>  drivers/gpu/drm/i915/display/intel_display.c | 100 ++++++++++++++++++-
>  drivers/gpu/drm/i915/display/intel_display.h |   2 +
>  drivers/gpu/drm/i915/display/intel_sprite.c  |  32 ++++--
>  drivers/gpu/drm/i915/i915_reg.h              |  21 ++++
>  include/drm/drm_crtc.h                       |  10 ++
>  include/drm/drm_mode_config.h                |   6 ++
>  include/drm/drm_plane.h                      |  14 +++
>  12 files changed, 252 insertions(+), 11 deletions(-)
> 
> -- 
> 2.23.0
Pankaj Bharadiya March 12, 2020, 3:37 p.m. UTC | #2
> -----Original Message-----
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Sent: 12 March 2020 19:35
> To: Laxminarayan Bharadiya, Pankaj
> <pankaj.laxminarayan.bharadiya@intel.com>
> Cc: jani.nikula@linux.intel.com; daniel@ffwll.ch; intel-
> gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; airlied@linux.ie;
> maarten.lankhorst@linux.intel.com; tzimmermann@suse.de;
> mripard@kernel.org; mihail.atanassov@arm.com; linux-
> kernel@vger.kernel.org; Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>
> Subject: Re: [RFC][PATCH 0/5] Introduce drm scaling filter property
> 
> On Tue, Feb 25, 2020 at 12:35:40PM +0530, Pankaj Bharadiya wrote:
> > Integer scaling (IS) is a nearest-neighbor upscaling technique that
> > simply scales up the existing pixels by an integer (i.e., whole
> > number) multiplier. Nearest-neighbor (NN) interpolation works by
> > filling in the missing color values in the upscaled image with that of
> > the coordinate-mapped nearest source pixel value.
> >
> > Both IS and NN preserve the clarity of the original image. In
> > contrast, traditional upscaling algorithms, such as bilinear or
> > bicubic interpolation, result in blurry upscaled images because they
> > employ interpolation techniques that smooth out the transition from
> > one pixel to another.  Therefore, integer scaling is particularly
> > useful for pixel art games that rely on sharp, blocky images to
> > deliver their distinctive look.
> >
> > Many gaming communities have been asking for integer-mode scaling
> > support, some links and background:
> >
> > https://software.intel.com/en-us/articles/integer-scaling-support-on-i
> > ntel-graphics http://tanalin.com/en/articles/lossless-scaling/
> > https://community.amd.com/thread/209107
> > https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002
> > /feature-request-nonblurry-upscaling-at-integer-rat/
> >
> > This patch series -
> >   - Introduces new scaling filter property to allow userspace to
> >     select  the driver's default scaling filter or Nearest-neighbor(NN)
> >     filter for scaling operations on crtc/plane.
> >   - Implements and enable integer scaling for i915
> >
> > Userspace patch series link: TBD.
> 
> That needs to be done or this will go nowhere.

Yes, Sameer is working on enabling this feature in Kodi. 
Sameer, please share link here once you post patches.
 
Thanks,
Pankaj

> 
> >
> > Thanks to Shashank for initiating this work. His initial RFC can be
> > found here [1]
> >
> > [1] https://patchwork.freedesktop.org/patch/337082/
> >
> > Modifications done in this series -
> >    - refactored code and incorporated initial review comments and
> >      added 2 scaling filter types (default and NN) to begin with.
> >    - added scaling filter property support for planes and new API
> >      helpers for drivers to setup this property.
> >    - rewrote code to enable integer scaling and NN filter for i915
> >
> >
> > Pankaj Bharadiya (5):
> >   drm: Introduce scaling filter property
> >   drm/drm-kms.rst: Add Scaling filter property documentation
> >   drm/i915: Enable scaling filter for plane and pipe
> >   drm/i915: Introduce scaling filter related registers and bit fields.
> >   drm/i915/display: Add Nearest-neighbor based integer scaling support
> >
> >  Documentation/gpu/drm-kms.rst                |   6 ++
> >  drivers/gpu/drm/drm_atomic_uapi.c            |   8 ++
> >  drivers/gpu/drm/drm_crtc.c                   |  16 +++
> >  drivers/gpu/drm/drm_mode_config.c            |  13 +++
> >  drivers/gpu/drm/drm_plane.c                  |  35 +++++++
> >  drivers/gpu/drm/i915/display/intel_display.c | 100 ++++++++++++++++++-
> >  drivers/gpu/drm/i915/display/intel_display.h |   2 +
> >  drivers/gpu/drm/i915/display/intel_sprite.c  |  32 ++++--
> >  drivers/gpu/drm/i915/i915_reg.h              |  21 ++++
> >  include/drm/drm_crtc.h                       |  10 ++
> >  include/drm/drm_mode_config.h                |   6 ++
> >  include/drm/drm_plane.h                      |  14 +++
> >  12 files changed, 252 insertions(+), 11 deletions(-)
> >
> > --
> > 2.23.0
> 
> --
> Ville Syrjälä
> Intel
Ville Syrjala March 12, 2020, 4:01 p.m. UTC | #3
On Thu, Mar 12, 2020 at 03:37:03PM +0000, Laxminarayan Bharadiya, Pankaj wrote:
> 
> 
> > -----Original Message-----
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Sent: 12 March 2020 19:35
> > To: Laxminarayan Bharadiya, Pankaj
> > <pankaj.laxminarayan.bharadiya@intel.com>
> > Cc: jani.nikula@linux.intel.com; daniel@ffwll.ch; intel-
> > gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; airlied@linux.ie;
> > maarten.lankhorst@linux.intel.com; tzimmermann@suse.de;
> > mripard@kernel.org; mihail.atanassov@arm.com; linux-
> > kernel@vger.kernel.org; Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>
> > Subject: Re: [RFC][PATCH 0/5] Introduce drm scaling filter property
> > 
> > On Tue, Feb 25, 2020 at 12:35:40PM +0530, Pankaj Bharadiya wrote:
> > > Integer scaling (IS) is a nearest-neighbor upscaling technique that
> > > simply scales up the existing pixels by an integer (i.e., whole
> > > number) multiplier. Nearest-neighbor (NN) interpolation works by
> > > filling in the missing color values in the upscaled image with that of
> > > the coordinate-mapped nearest source pixel value.
> > >
> > > Both IS and NN preserve the clarity of the original image. In
> > > contrast, traditional upscaling algorithms, such as bilinear or
> > > bicubic interpolation, result in blurry upscaled images because they
> > > employ interpolation techniques that smooth out the transition from
> > > one pixel to another.  Therefore, integer scaling is particularly
> > > useful for pixel art games that rely on sharp, blocky images to
> > > deliver their distinctive look.
> > >
> > > Many gaming communities have been asking for integer-mode scaling
> > > support, some links and background:
> > >
> > > https://software.intel.com/en-us/articles/integer-scaling-support-on-i
> > > ntel-graphics http://tanalin.com/en/articles/lossless-scaling/
> > > https://community.amd.com/thread/209107
> > > https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002
> > > /feature-request-nonblurry-upscaling-at-integer-rat/
> > >
> > > This patch series -
> > >   - Introduces new scaling filter property to allow userspace to
> > >     select  the driver's default scaling filter or Nearest-neighbor(NN)
> > >     filter for scaling operations on crtc/plane.
> > >   - Implements and enable integer scaling for i915
> > >
> > > Userspace patch series link: TBD.
> > 
> > That needs to be done or this will go nowhere.
> 
> Yes, Sameer is working on enabling this feature in Kodi. 
> Sameer, please share link here once you post patches.

And who is doing it for other stuff? I think this would be most useful
for games/emulators and such so IMO we should find a way to get it to
the hands of users doing those things.
Pekka Paalanen March 13, 2020, 10:35 a.m. UTC | #4
On Thu, 12 Mar 2020 18:01:12 +0200
Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:

> On Thu, Mar 12, 2020 at 03:37:03PM +0000, Laxminarayan Bharadiya, Pankaj wrote:
> > 
> >   
> > > -----Original Message-----
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > Sent: 12 March 2020 19:35
> > > To: Laxminarayan Bharadiya, Pankaj
> > > <pankaj.laxminarayan.bharadiya@intel.com>
> > > Cc: jani.nikula@linux.intel.com; daniel@ffwll.ch; intel-
> > > gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org; airlied@linux.ie;
> > > maarten.lankhorst@linux.intel.com; tzimmermann@suse.de;
> > > mripard@kernel.org; mihail.atanassov@arm.com; linux-
> > > kernel@vger.kernel.org; Nautiyal, Ankit K <ankit.k.nautiyal@intel.com>
> > > Subject: Re: [RFC][PATCH 0/5] Introduce drm scaling filter property
> > > 
> > > On Tue, Feb 25, 2020 at 12:35:40PM +0530, Pankaj Bharadiya wrote:  
> > > > Integer scaling (IS) is a nearest-neighbor upscaling technique that
> > > > simply scales up the existing pixels by an integer (i.e., whole
> > > > number) multiplier. Nearest-neighbor (NN) interpolation works by
> > > > filling in the missing color values in the upscaled image with that of
> > > > the coordinate-mapped nearest source pixel value.
> > > >
> > > > Both IS and NN preserve the clarity of the original image. In
> > > > contrast, traditional upscaling algorithms, such as bilinear or
> > > > bicubic interpolation, result in blurry upscaled images because they
> > > > employ interpolation techniques that smooth out the transition from
> > > > one pixel to another.  Therefore, integer scaling is particularly
> > > > useful for pixel art games that rely on sharp, blocky images to
> > > > deliver their distinctive look.
> > > >
> > > > Many gaming communities have been asking for integer-mode scaling
> > > > support, some links and background:
> > > >
> > > > https://software.intel.com/en-us/articles/integer-scaling-support-on-i
> > > > ntel-graphics http://tanalin.com/en/articles/lossless-scaling/
> > > > https://community.amd.com/thread/209107
> > > > https://www.nvidia.com/en-us/geforce/forums/game-ready-drivers/13/1002
> > > > /feature-request-nonblurry-upscaling-at-integer-rat/
> > > >
> > > > This patch series -
> > > >   - Introduces new scaling filter property to allow userspace to
> > > >     select  the driver's default scaling filter or Nearest-neighbor(NN)
> > > >     filter for scaling operations on crtc/plane.
> > > >   - Implements and enable integer scaling for i915
> > > >
> > > > Userspace patch series link: TBD.  
> > > 
> > > That needs to be done or this will go nowhere.  
> > 
> > Yes, Sameer is working on enabling this feature in Kodi. 
> > Sameer, please share link here once you post patches.  
> 
> And who is doing it for other stuff? I think this would be most useful
> for games/emulators and such so IMO we should find a way to get it to
> the hands of users doing those things.
> 

Hi,

FWIW, being able to tell KMS to use nearest-neighbor filtering could be
useful for
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/394
as a follow-up.


Thanks,
pq