mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 22:10:03 +01:00
fb: backport fb changes from master for src window operations.
This rolls up the following commits and also keeps the image_from_pict API compatiblity. It introduces a new image_from_pict_18 API that is used by the server leaving the old API alone. I've rolled this up as I don't want to introduce ABI breaks in bisection.a72c65e917fb: Adjust transform or composite coordinates for pixman operationsbd567061c8Split fbGetDrawable into fbGetDrawablePixmap and fbGetPixmapBitsData6133505297Revert "Fix clipping when windows are used as sources"071b3c1810Revert "Use IncludeInferiors when copying windows before compositing."8e640d6b13Revert "Reserve space for two GC values in copy_drawable()." Signed-off-by: Dave Airlie <airlied@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
a2daadf914
commit
2d6a8f6683
4 changed files with 108 additions and 60 deletions
76
fb/fb.h
76
fb/fb.h
|
|
@ -700,38 +700,41 @@ typedef struct {
|
||||||
#define __fbPixOffXPix(pPix) (__fbPixDrawableX(pPix))
|
#define __fbPixOffXPix(pPix) (__fbPixDrawableX(pPix))
|
||||||
#define __fbPixOffYPix(pPix) (__fbPixDrawableY(pPix))
|
#define __fbPixOffYPix(pPix) (__fbPixDrawableY(pPix))
|
||||||
|
|
||||||
#define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
|
#define fbGetDrawablePixmap(pDrawable, pixmap, xoff, yoff) { \
|
||||||
PixmapPtr _pPix; \
|
if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
|
||||||
if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
|
(pixmap) = fbGetWindowPixmap(pDrawable); \
|
||||||
_pPix = fbGetWindowPixmap(pDrawable); \
|
(xoff) = __fbPixOffXWin(pixmap); \
|
||||||
(xoff) = __fbPixOffXWin(_pPix); \
|
(yoff) = __fbPixOffYWin(pixmap); \
|
||||||
(yoff) = __fbPixOffYWin(_pPix); \
|
} else { \
|
||||||
} else { \
|
(pixmap) = (PixmapPtr) (pDrawable); \
|
||||||
_pPix = (PixmapPtr) (pDrawable); \
|
(xoff) = __fbPixOffXPix(pixmap); \
|
||||||
(xoff) = __fbPixOffXPix(_pPix); \
|
(yoff) = __fbPixOffYPix(pixmap); \
|
||||||
(yoff) = __fbPixOffYPix(_pPix); \
|
} \
|
||||||
} \
|
fbPrepareAccess(pDrawable); \
|
||||||
fbPrepareAccess(pDrawable); \
|
|
||||||
(pointer) = (FbBits *) _pPix->devPrivate.ptr; \
|
|
||||||
(stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \
|
|
||||||
(bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
|
#define fbGetPixmapBitsData(pixmap, pointer, stride, bpp) { \
|
||||||
PixmapPtr _pPix; \
|
(pointer) = (FbBits *) (pixmap)->devPrivate.ptr; \
|
||||||
if ((pDrawable)->type != DRAWABLE_PIXMAP) { \
|
(stride) = ((int) (pixmap)->devKind) / sizeof (FbBits); (void)(stride); \
|
||||||
_pPix = fbGetWindowPixmap(pDrawable); \
|
(bpp) = (pixmap)->drawable.bitsPerPixel; (void)(bpp); \
|
||||||
(xoff) = __fbPixOffXWin(_pPix); \
|
}
|
||||||
(yoff) = __fbPixOffYWin(_pPix); \
|
|
||||||
} else { \
|
#define fbGetPixmapStipData(pixmap, pointer, stride, bpp) { \
|
||||||
_pPix = (PixmapPtr) (pDrawable); \
|
(pointer) = (FbStip *) (pixmap)->devPrivate.ptr; \
|
||||||
(xoff) = __fbPixOffXPix(_pPix); \
|
(stride) = ((int) (pixmap)->devKind) / sizeof (FbStip); (void)(stride); \
|
||||||
(yoff) = __fbPixOffYPix(_pPix); \
|
(bpp) = (pixmap)->drawable.bitsPerPixel; (void)(bpp); \
|
||||||
} \
|
}
|
||||||
fbPrepareAccess(pDrawable); \
|
|
||||||
(pointer) = (FbStip *) _pPix->devPrivate.ptr; \
|
#define fbGetDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
|
||||||
(stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \
|
PixmapPtr _pPix; \
|
||||||
(bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
|
fbGetDrawablePixmap(pDrawable, _pPix, xoff, yoff); \
|
||||||
|
fbGetPixmapBitsData(_pPix, pointer, stride, bpp); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
|
||||||
|
PixmapPtr _pPix; \
|
||||||
|
fbGetDrawablePixmap(pDrawable, _pPix, xoff, yoff); \
|
||||||
|
fbGetPixmapStipData(_pPix, pointer, stride, bpp); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -2079,9 +2082,16 @@ fbFillRegionSolid (DrawablePtr pDrawable,
|
||||||
FbBits xor);
|
FbBits xor);
|
||||||
|
|
||||||
extern _X_EXPORT pixman_image_t *
|
extern _X_EXPORT pixman_image_t *
|
||||||
image_from_pict (PicturePtr pict,
|
image_from_pict (PicturePtr pict,
|
||||||
Bool has_clip,
|
Bool has_clip,
|
||||||
Bool is_src);
|
Bool is_src);
|
||||||
|
|
||||||
|
extern _X_EXPORT pixman_image_t *
|
||||||
|
image_from_pict_18 (PicturePtr pict,
|
||||||
|
Bool has_clip,
|
||||||
|
int *xoff,
|
||||||
|
int *yoff);
|
||||||
|
|
||||||
extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
|
extern _X_EXPORT void free_pixman_pict (PicturePtr, pixman_image_t *);
|
||||||
|
|
||||||
#endif /* _FB_H_ */
|
#endif /* _FB_H_ */
|
||||||
|
|
|
||||||
85
fb/fbpict.c
85
fb/fbpict.c
|
|
@ -158,19 +158,24 @@ fbComposite (CARD8 op,
|
||||||
CARD16 height)
|
CARD16 height)
|
||||||
{
|
{
|
||||||
pixman_image_t *src, *mask, *dest;
|
pixman_image_t *src, *mask, *dest;
|
||||||
|
int src_xoff, src_yoff;
|
||||||
|
int msk_xoff, msk_yoff;
|
||||||
|
int dst_xoff, dst_yoff;
|
||||||
|
|
||||||
miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height);
|
miCompositeSourceValidate (pSrc, xSrc - xDst, ySrc - yDst, width, height);
|
||||||
if (pMask)
|
if (pMask)
|
||||||
miCompositeSourceValidate (pMask, xMask, yMask, width, height);
|
miCompositeSourceValidate (pMask, xMask - xDst, yMask - yDst, width, height);
|
||||||
|
|
||||||
src = image_from_pict (pSrc, TRUE, TRUE);
|
src = image_from_pict_18 (pSrc, FALSE, &src_xoff, &src_yoff);
|
||||||
mask = image_from_pict (pMask, TRUE, TRUE);
|
mask = image_from_pict_18 (pMask, FALSE, &msk_xoff, &msk_yoff);
|
||||||
dest = image_from_pict (pDst, TRUE, FALSE);
|
dest = image_from_pict_18 (pDst, TRUE, &dst_xoff, &dst_yoff);
|
||||||
|
|
||||||
if (src && dest && !(pMask && !mask))
|
if (src && dest && !(pMask && !mask))
|
||||||
{
|
{
|
||||||
pixman_image_composite (op, src, mask, dest,
|
pixman_image_composite (op, src, mask, dest,
|
||||||
xSrc, ySrc, xMask, yMask, xDst, yDst,
|
xSrc + src_xoff, ySrc + src_yoff,
|
||||||
|
xMask + msk_xoff, yMask + msk_yoff,
|
||||||
|
xDst + dst_xoff, yDst + dst_yoff,
|
||||||
width, height);
|
width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,22 +275,22 @@ create_conical_gradient_image (PictGradient *gradient)
|
||||||
|
|
||||||
static pixman_image_t *
|
static pixman_image_t *
|
||||||
create_bits_picture (PicturePtr pict,
|
create_bits_picture (PicturePtr pict,
|
||||||
Bool has_clip)
|
Bool has_clip,
|
||||||
|
int *xoff,
|
||||||
|
int *yoff)
|
||||||
{
|
{
|
||||||
|
PixmapPtr pixmap;
|
||||||
FbBits *bits;
|
FbBits *bits;
|
||||||
FbStride stride;
|
FbStride stride;
|
||||||
int bpp, xoff, yoff;
|
int bpp;
|
||||||
pixman_image_t *image;
|
pixman_image_t *image;
|
||||||
|
|
||||||
fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
|
fbGetDrawablePixmap (pict->pDrawable, pixmap, *xoff, *yoff);
|
||||||
|
fbGetPixmapBitsData(pixmap, bits, stride, bpp);
|
||||||
bits = (FbBits*)((CARD8*)bits +
|
|
||||||
(pict->pDrawable->y + yoff) * stride * sizeof(FbBits) +
|
|
||||||
(pict->pDrawable->x + xoff) * (bpp / 8));
|
|
||||||
|
|
||||||
image = pixman_image_create_bits (
|
image = pixman_image_create_bits (
|
||||||
pict->format,
|
pict->format,
|
||||||
pict->pDrawable->width, pict->pDrawable->height,
|
pixmap->drawable.width, pixmap->drawable.height,
|
||||||
(uint32_t *)bits, stride * sizeof (FbStride));
|
(uint32_t *)bits, stride * sizeof (FbStride));
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -311,30 +316,52 @@ create_bits_picture (PicturePtr pict,
|
||||||
if (pict->clientClipType != CT_NONE)
|
if (pict->clientClipType != CT_NONE)
|
||||||
pixman_image_set_has_client_clip (image, TRUE);
|
pixman_image_set_has_client_clip (image, TRUE);
|
||||||
|
|
||||||
pixman_region_translate (pict->pCompositeClip, - pict->pDrawable->x, - pict->pDrawable->y);
|
if (*xoff || *yoff)
|
||||||
|
pixman_region_translate (pict->pCompositeClip, *xoff, *yoff);
|
||||||
|
|
||||||
pixman_image_set_clip_region (image, pict->pCompositeClip);
|
pixman_image_set_clip_region (image, pict->pCompositeClip);
|
||||||
|
|
||||||
pixman_region_translate (pict->pCompositeClip, pict->pDrawable->x, pict->pDrawable->y);
|
if (*xoff || *yoff)
|
||||||
|
pixman_region_translate (pict->pCompositeClip, -*xoff, -*yoff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Indexed table */
|
/* Indexed table */
|
||||||
if (pict->pFormat->index.devPrivate)
|
if (pict->pFormat->index.devPrivate)
|
||||||
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
|
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
|
||||||
|
|
||||||
|
/* Add in drawable origin to position within the image */
|
||||||
|
*xoff += pict->pDrawable->x;
|
||||||
|
*yoff += pict->pDrawable->y;
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_image_properties (pixman_image_t *image, PicturePtr pict)
|
set_image_properties (pixman_image_t *image, PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
|
||||||
{
|
{
|
||||||
pixman_repeat_t repeat;
|
pixman_repeat_t repeat;
|
||||||
pixman_filter_t filter;
|
pixman_filter_t filter;
|
||||||
|
|
||||||
if (pict->transform)
|
if (pict->transform)
|
||||||
{
|
{
|
||||||
pixman_image_set_transform (
|
/* For source images, adjust the transform to account
|
||||||
image, (pixman_transform_t *)pict->transform);
|
* for the drawable offset within the pixman image,
|
||||||
|
* then set the offset to 0 as it will be used
|
||||||
|
* to compute positions within the transformed image.
|
||||||
|
*/
|
||||||
|
if (!has_clip) {
|
||||||
|
struct pixman_transform adjusted;
|
||||||
|
|
||||||
|
adjusted = *pict->transform;
|
||||||
|
pixman_transform_translate(&adjusted,
|
||||||
|
NULL,
|
||||||
|
pixman_int_to_fixed(*xoff),
|
||||||
|
pixman_int_to_fixed(*yoff));
|
||||||
|
pixman_image_set_transform (image, &adjusted);
|
||||||
|
*xoff = 0;
|
||||||
|
*yoff = 0;
|
||||||
|
} else
|
||||||
|
pixman_image_set_transform (image, pict->transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (pict->repeatType)
|
switch (pict->repeatType)
|
||||||
|
|
@ -361,7 +388,8 @@ set_image_properties (pixman_image_t *image, PicturePtr pict)
|
||||||
|
|
||||||
if (pict->alphaMap)
|
if (pict->alphaMap)
|
||||||
{
|
{
|
||||||
pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, TRUE, TRUE);
|
int alpha_xoff, alpha_yoff;
|
||||||
|
pixman_image_t *alpha_map = image_from_pict_18 (pict->alphaMap, FALSE, &alpha_xoff, &alpha_yoff);
|
||||||
|
|
||||||
pixman_image_set_alpha_map (
|
pixman_image_set_alpha_map (
|
||||||
image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
|
image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
|
||||||
|
|
@ -393,10 +421,9 @@ set_image_properties (pixman_image_t *image, PicturePtr pict)
|
||||||
pixman_image_set_source_clipping (image, TRUE);
|
pixman_image_set_source_clipping (image, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pixman_image_t *
|
pixman_image_t *
|
||||||
image_from_pict (PicturePtr pict,
|
image_from_pict_18 (PicturePtr pict, Bool has_clip, int *xoff, int *yoff)
|
||||||
Bool has_clip,
|
|
||||||
Bool is_src)
|
|
||||||
{
|
{
|
||||||
pixman_image_t *image = NULL;
|
pixman_image_t *image = NULL;
|
||||||
|
|
||||||
|
|
@ -405,7 +432,7 @@ image_from_pict (PicturePtr pict,
|
||||||
|
|
||||||
if (pict->pDrawable)
|
if (pict->pDrawable)
|
||||||
{
|
{
|
||||||
image = create_bits_picture (pict, has_clip);
|
image = create_bits_picture (pict, has_clip, xoff, yoff);
|
||||||
}
|
}
|
||||||
else if (pict->pSourcePict)
|
else if (pict->pSourcePict)
|
||||||
{
|
{
|
||||||
|
|
@ -429,11 +456,18 @@ image_from_pict (PicturePtr pict,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (image)
|
if (image)
|
||||||
set_image_properties (image, pict);
|
set_image_properties (image, pict, has_clip, xoff, yoff);
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pixman_image_t *
|
||||||
|
image_from_pict (PicturePtr pict, Bool has_clip, Bool is_src)
|
||||||
|
{
|
||||||
|
int xoff = 0, yoff = 0;
|
||||||
|
return image_from_pict_18(pict, has_clip, &xoff, &yoff);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
free_pixman_pict (PicturePtr pict, pixman_image_t *image)
|
free_pixman_pict (PicturePtr pict, pixman_image_t *image)
|
||||||
{
|
{
|
||||||
|
|
@ -463,3 +497,4 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,8 @@ fbAddTraps (PicturePtr pPicture,
|
||||||
int ntrap,
|
int ntrap,
|
||||||
xTrap *traps)
|
xTrap *traps)
|
||||||
{
|
{
|
||||||
pixman_image_t *image = image_from_pict (pPicture, FALSE, FALSE);
|
int image_xoff, image_yoff;
|
||||||
|
pixman_image_t *image = image_from_pict_18 (pPicture, FALSE, &image_xoff, &image_yoff);
|
||||||
|
|
||||||
if (!image)
|
if (!image)
|
||||||
return;
|
return;
|
||||||
|
|
@ -56,7 +57,8 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
|
||||||
int x_off,
|
int x_off,
|
||||||
int y_off)
|
int y_off)
|
||||||
{
|
{
|
||||||
pixman_image_t *image = image_from_pict (pPicture, FALSE, FALSE);
|
int mask_xoff, mask_yoff;
|
||||||
|
pixman_image_t *image = image_from_pict_18 (pPicture, FALSE, &mask_xoff, &mask_yoff);
|
||||||
|
|
||||||
if (!image)
|
if (!image)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -187,4 +187,5 @@
|
||||||
#define fbZeroSegment wfbZeroSegment
|
#define fbZeroSegment wfbZeroSegment
|
||||||
#define free_pixman_pict wfb_free_pixman_pict
|
#define free_pixman_pict wfb_free_pixman_pict
|
||||||
#define image_from_pict wfb_image_from_pict
|
#define image_from_pict wfb_image_from_pict
|
||||||
|
#define image_from_pict_18 wfb_image_from_pict_18
|
||||||
#define composeFunctions wfbComposeFunctions
|
#define composeFunctions wfbComposeFunctions
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue