[PATCH] modesetting: Support native primary plane rotation
Mark Kettenis
mark.kettenis at xs4all.nl
Wed Jul 9 02:09:13 PDT 2014
> Date: Wed, 09 Jul 2014 09:28:31 +0200
> From: walter harms <wharms at bfs.de>
>
> Am 09.07.2014 09:00, schrieb Chris Wilson:
> > With the advent of universal drm planes and the introduction of generic
> > plane properties for rotations, we can query and program the hardware
> > for native rotation support.
> >
> > NOTE: this depends upon the next release of libdrm to remove some
> > opencoded defines.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> > configure.ac | 2 +-
> > src/drmmode_display.c | 223 +++++++++++++++++++++++++++++++++++++++++++-------
> > src/drmmode_display.h | 7 +-
> > 3 files changed, 199 insertions(+), 33 deletions(-)
> >
> > diff --git a/configure.ac b/configure.ac
> > index 1c1a36d..0b4e857 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -74,7 +74,7 @@ AM_CONDITIONAL(HAVE_XEXTPROTO_71, [ test "$HAVE_XEXTPROTO_71" = "yes" ])
> > # Checks for header files.
> > AC_HEADER_STDC
> >
> > -PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.46])
> > +PKG_CHECK_MODULES(DRM, [libdrm >= 2.4.54]) #.55 required for universal planes
> > PKG_CHECK_MODULES([PCIACCESS], [pciaccess >= 0.10])
> > AM_CONDITIONAL(DRM, test "x$DRM" = xyes)
> >
> > diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> > index c533324..aaeda39 100644
> > --- a/src/drmmode_display.c
> > +++ b/src/drmmode_display.c
> > @@ -56,6 +56,11 @@
> >
> > #include "driver.h"
> >
> > +#define DRM_CLIENT_CAP_UNIVERSAL_PLANES 2
> > +#define DRM_PLANE_TYPE_OVERLAY 0
> > +#define DRM_PLANE_TYPE_PRIMARY 1
> > +#define DRM_PLANE_TYPE_CURSOR 2
> > +
> > static struct dumb_bo *dumb_bo_create(int fd,
> > const unsigned width, const unsigned height,
> > const unsigned bpp)
> > @@ -300,6 +305,136 @@ create_pixmap_for_fbcon(drmmode_ptr drmmode,
> >
> > #endif
> >
> > +static unsigned
> > +rotation_index(unsigned rotation)
> > +{
> > +#if _SVID_SOURCE || _BSD_SOURCE || _POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700
> > + return ffs(rotation) - 1;
> > +#else
> > + int i;
> > +
> > + for (i = 0; i < 32; i++) {
> > + if ((1 << i) == rotation)
> > + break;
> > + }
> > +
> > + return i;
> > +#endif
> > +}
>
>
> perhaps it is better to provide an internal ffs for systems that
> lack one ? than you can use ffs() directly and leave the rest to
> configure. That would result in a generic HAVE_FFS instead of a
> list of defines like this now.
Seriously though, what system that supports the modesetting interfaces
does actually lack ffs(3)?
More information about the xorg-devel
mailing list