xfree86: make xf86RotateCrtcRedisplay public

xf86RotateCrtcRedisplay() is about to be used outside of xf86Rotate.c in
order to copy transformed pixmaps, so fix up its interface by specifying
the source drawable and destination pixmap rather than assuming the root
drawable and rotated pixmap, respectively. In addition, add an argument to
make xf86RotateCrtcRedisplay() not perform any transformations, which is an
indicator that it should only copy a transformed pixmap rather than
actually transform a pixmap.

These changes make it possible to use xf86RotateCrtcRedisplay() to not
only copy transformed pixmaps, but also actually transform pixmaps, making
it very useful outside of xf86Rotate.c.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2022-12-05 23:20:31 -08:00
parent 08183c66e8
commit 07ad7a1138
3 changed files with 19 additions and 10 deletions

View File

@ -74,7 +74,7 @@
* mask is 0xFFFF0000. * mask is 0xFFFF0000.
*/ */
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(25, 3) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(25, 4)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(24, 4) #define ABI_XINPUT_VERSION SET_ABI_VERSION(24, 4)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(10, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(10, 0)

View File

@ -912,6 +912,11 @@ extern _X_EXPORT void
extern _X_EXPORT Bool extern _X_EXPORT Bool
xf86CrtcRotate(xf86CrtcPtr crtc); xf86CrtcRotate(xf86CrtcPtr crtc);
extern _X_EXPORT void
xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, PixmapPtr dst_pixmap,
DrawableRec *src_drawable, RegionPtr region,
Bool transform_src);
/* /*
* Clean up any rotation data, used when a crtc is turned off * Clean up any rotation data, used when a crtc is turned off
* as well as when rotation is disabled. * as well as when rotation is disabled.

View File

@ -39,13 +39,13 @@
#include "X11/extensions/dpmsconst.h" #include "X11/extensions/dpmsconst.h"
#include "X11/Xatom.h" #include "X11/Xatom.h"
static void void
xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region) xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, PixmapPtr dst_pixmap,
DrawableRec *src_drawable, RegionPtr region,
Bool transform_src)
{ {
ScrnInfoPtr scrn = crtc->scrn; ScrnInfoPtr scrn = crtc->scrn;
ScreenPtr screen = scrn->pScreen; ScreenPtr screen = scrn->pScreen;
WindowPtr root = screen->root;
PixmapPtr dst_pixmap = crtc->rotatedPixmap;
PictFormatPtr format = PictureWindowFormat(screen->root); PictFormatPtr format = PictureWindowFormat(screen->root);
int error; int error;
PicturePtr src, dst; PicturePtr src, dst;
@ -57,7 +57,7 @@ xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region)
return; return;
src = CreatePicture(None, src = CreatePicture(None,
&root->drawable, src_drawable,
format, format,
CPSubwindowMode, CPSubwindowMode,
&include_inferiors, serverClient, &error); &include_inferiors, serverClient, &error);
@ -70,9 +70,11 @@ xf86RotateCrtcRedisplay(xf86CrtcPtr crtc, RegionPtr region)
if (!dst) if (!dst)
return; return;
error = SetPictureTransform(src, &crtc->crtc_to_framebuffer); if (transform_src) {
if (error) error = SetPictureTransform(src, &crtc->crtc_to_framebuffer);
return; if (error)
return;
}
if (crtc->transform_in_use && crtc->filter) if (crtc->transform_in_use && crtc->filter)
SetPicturePictFilter(src, crtc->filter, crtc->params, crtc->nparams); SetPicturePictFilter(src, crtc->filter, crtc->params, crtc->nparams);
@ -205,7 +207,9 @@ xf86RotateRedisplay(ScreenPtr pScreen)
/* update damaged region */ /* update damaged region */
if (RegionNotEmpty(&crtc_damage)) if (RegionNotEmpty(&crtc_damage))
xf86RotateCrtcRedisplay(crtc, &crtc_damage); xf86RotateCrtcRedisplay(crtc, crtc->rotatedPixmap,
&pScreen->root->drawable,
&crtc_damage, TRUE);
RegionUninit(&crtc_damage); RegionUninit(&crtc_damage);
} }