summaryrefslogtreecommitdiff
path: root/driver/xf86-video-intel/uxa
diff options
context:
space:
mode:
Diffstat (limited to 'driver/xf86-video-intel/uxa')
-rw-r--r--driver/xf86-video-intel/uxa/Makefile.in18
-rw-r--r--driver/xf86-video-intel/uxa/uxa-accel.c432
-rw-r--r--driver/xf86-video-intel/uxa/uxa-glyphs.c76
-rw-r--r--driver/xf86-video-intel/uxa/uxa-priv.h7
-rw-r--r--driver/xf86-video-intel/uxa/uxa-render.c223
-rw-r--r--driver/xf86-video-intel/uxa/uxa-unaccel.c50
-rw-r--r--driver/xf86-video-intel/uxa/uxa.c26
-rw-r--r--driver/xf86-video-intel/uxa/uxa.h1
8 files changed, 383 insertions, 450 deletions
diff --git a/driver/xf86-video-intel/uxa/Makefile.in b/driver/xf86-video-intel/uxa/Makefile.in
index b50b9cb3f..16f2b4c8a 100644
--- a/driver/xf86-video-intel/uxa/Makefile.in
+++ b/driver/xf86-video-intel/uxa/Makefile.in
@@ -80,10 +80,6 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
-BUILD_LINUXDOC_FALSE = @BUILD_LINUXDOC_FALSE@
-BUILD_LINUXDOC_TRUE = @BUILD_LINUXDOC_TRUE@
-BUILD_PDFDOC_FALSE = @BUILD_PDFDOC_FALSE@
-BUILD_PDFDOC_TRUE = @BUILD_PDFDOC_TRUE@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -123,8 +119,6 @@ GEN4ASM_LIBS = @GEN4ASM_LIBS@
GREP = @GREP@
HAVE_GEN4ASM_FALSE = @HAVE_GEN4ASM_FALSE@
HAVE_GEN4ASM_TRUE = @HAVE_GEN4ASM_TRUE@
-HAVE_XEXTPROTO_71_FALSE = @HAVE_XEXTPROTO_71_FALSE@
-HAVE_XEXTPROTO_71_TRUE = @HAVE_XEXTPROTO_71_TRUE@
INSTALL_CMD = @INSTALL_CMD@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -138,17 +132,13 @@ LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
-LINUXDOC = @LINUXDOC@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MAKE_HTML = @MAKE_HTML@
-MAKE_PDF = @MAKE_PDF@
-MAKE_PS = @MAKE_PS@
-MAKE_TEXT = @MAKE_TEXT@
+MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
NMEDIT = @NMEDIT@
@@ -163,19 +153,15 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PCIACCESS_CFLAGS = @PCIACCESS_CFLAGS@
PCIACCESS_LIBS = @PCIACCESS_LIBS@
PKG_CONFIG = @PKG_CONFIG@
-PS2PDF = @PS2PDF@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
-VIDEO_DEBUG_FALSE = @VIDEO_DEBUG_FALSE@
-VIDEO_DEBUG_TRUE = @VIDEO_DEBUG_TRUE@
-XEXT_CFLAGS = @XEXT_CFLAGS@
-XEXT_LIBS = @XEXT_LIBS@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_LIBS = @XORG_LIBS@
+XORG_MAN_PAGE = @XORG_MAN_PAGE@
XVMCLIB_CFLAGS = @XVMCLIB_CFLAGS@
XVMCLIB_LIBS = @XVMCLIB_LIBS@
XVMC_FALSE = @XVMC_FALSE@
diff --git a/driver/xf86-video-intel/uxa/uxa-accel.c b/driver/xf86-video-intel/uxa/uxa-accel.c
index 245738a65..301af2f4d 100644
--- a/driver/xf86-video-intel/uxa/uxa-accel.c
+++ b/driver/xf86-video-intel/uxa/uxa-accel.c
@@ -1,3 +1,4 @@
+
/*
* Copyright ® 2001 Keith Packard
*
@@ -36,24 +37,6 @@
#include "uxa.h"
#include "mipict.h"
-static CARD32
-format_for_depth(int depth)
-{
- switch (depth) {
- case 1: return PICT_a1;
- case 4: return PICT_a4;
- case 8: return PICT_a8;
- case 15: return PICT_x1r5g5b5;
- case 16: return PICT_r5g6b5;
- default:
- case 24: return PICT_x8r8g8b8;
-#if 0
- case 30: return PICT_x2r10g10b10;
-#endif
- case 32: return PICT_a8r8g8b8;
- }
-}
-
static void
uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
DDXPointPtr ppt, int *pwidth, int fSorted)
@@ -61,19 +44,13 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
ScreenPtr screen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
RegionPtr pClip = fbGetCompositeClip(pGC);
- PixmapPtr dst_pixmap, src_pixmap = NULL;
- BoxPtr pextent, pbox;
+ PixmapPtr dst_pixmap;
+ BoxPtr pbox;
int nbox;
- int extentX1, extentX2, extentY1, extentY2;
- int fullX1, fullX2, fullY1;
- int partX1, partX2;
+ int x1, x2, y;
int off_x, off_y;
- xRenderColor color;
- PictFormatPtr format;
- PicturePtr dst, src;
- int error;
- if (uxa_screen->swappedOut)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
if (pGC->fillStyle != FillSolid)
@@ -83,125 +60,6 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
if (!dst_pixmap)
goto fallback;
- if (pGC->alu != GXcopy || pGC->planemask != FB_ALLONES)
- goto solid;
-
- format = PictureMatchFormat(screen,
- dst_pixmap->drawable.depth,
- format_for_depth(dst_pixmap->drawable.depth));
- dst = CreatePicture(0, &dst_pixmap->drawable, format, 0, 0, serverClient, &error);
- if (!dst)
- goto solid;
-
- ValidatePicture(dst);
-
- uxa_get_rgba_from_pixel(pGC->fgPixel,
- &color.red,
- &color.green,
- &color.blue,
- &color.alpha,
- format_for_depth(dst_pixmap->drawable.depth));
- src = CreateSolidPicture(0, &color, &error);
- if (!src) {
- FreePicture(dst, 0);
- goto solid;
- }
-
- if (!uxa_screen->info->check_composite(PictOpSrc, src, NULL, dst, 0, 0)) {
- FreePicture(src, 0);
- FreePicture(dst, 0);
- goto solid;
- }
-
- if (!uxa_screen->info->check_composite_texture ||
- !uxa_screen->info->check_composite_texture(screen, src)) {
- PicturePtr solid;
- int src_off_x, src_off_y;
-
- solid = uxa_acquire_solid(screen, src->pSourcePict);
- FreePicture(src, 0);
-
- src = solid;
- src_pixmap = uxa_get_offscreen_pixmap(src->pDrawable,
- &src_off_x, &src_off_y);
- if (!src_pixmap) {
- FreePicture(src, 0);
- FreePicture(dst, 0);
- goto solid;
- }
- }
-
- if (!uxa_screen->info->prepare_composite(PictOpSrc, src, NULL, dst, src_pixmap, NULL, dst_pixmap)) {
- FreePicture(src, 0);
- FreePicture(dst, 0);
- goto solid;
- }
-
- pextent = REGION_EXTENTS(pGC->screen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
- while (n--) {
- fullX1 = ppt->x;
- fullY1 = ppt->y;
- fullX2 = fullX1 + (int)*pwidth;
- ppt++;
- pwidth++;
-
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
-
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
-
- if (fullX1 >= fullX2)
- continue;
-
- nbox = REGION_NUM_RECTS(pClip);
- if (nbox == 1) {
- uxa_screen->info->composite(dst_pixmap,
- 0, 0, 0, 0,
- fullX1 + off_x,
- fullY1 + off_y,
- fullX2 - fullX1, 1);
- } else {
- pbox = REGION_RECTS(pClip);
- while (nbox--) {
- if (pbox->y1 > fullY1)
- break;
-
- if (pbox->y1 <= fullY1) {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
-
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
-
- if (partX2 > partX1) {
- uxa_screen->info->composite(dst_pixmap,
- 0, 0, 0, 0,
- partX1 + off_x,
- fullY1 + off_y,
- partX2 - partX1, 1);
- }
- }
- pbox++;
- }
- }
- }
-
- uxa_screen->info->done_composite(dst_pixmap);
- FreePicture(src, 0);
- FreePicture(dst, 0);
- return;
-
-solid:
if (uxa_screen->info->check_solid &&
!uxa_screen->info->check_solid(pDrawable, pGC->alu, pGC->planemask))
goto fallback;
@@ -212,58 +70,32 @@ solid:
pGC->fgPixel))
goto fallback;
- pextent = REGION_EXTENTS(pGC->screen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
while (n--) {
- fullX1 = ppt->x;
- fullY1 = ppt->y;
- fullX2 = fullX1 + (int)*pwidth;
+ x1 = ppt->x;
+ y = ppt->y;
+ x2 = x1 + (int)*pwidth;
ppt++;
pwidth++;
- if (fullY1 < extentY1 || extentY2 <= fullY1)
- continue;
+ nbox = REGION_NUM_RECTS(pClip);
+ pbox = REGION_RECTS(pClip);
+ while (nbox--) {
+ if (pbox->y1 > y || pbox->y2 <= y)
+ continue;
- if (fullX1 < extentX1)
- fullX1 = extentX1;
+ if (x1 < pbox->x1)
+ x1 = pbox->x1;
- if (fullX2 > extentX2)
- fullX2 = extentX2;
+ if (x2 > pbox->x2)
+ x2 = pbox->x2;
- if (fullX1 >= fullX2)
- continue;
+ if (x2 <= x1)
+ continue;
- nbox = REGION_NUM_RECTS(pClip);
- if (nbox == 1) {
(*uxa_screen->info->solid) (dst_pixmap,
- fullX1 + off_x,
- fullY1 + off_y,
- fullX2 + off_x,
- fullY1 + 1 + off_y);
- } else {
- pbox = REGION_RECTS(pClip);
- while (nbox--) {
- if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- if (partX2 > partX1) {
- (*uxa_screen->info->
- solid) (dst_pixmap,
- partX1 + off_x,
- fullY1 + off_y,
- partX2 + off_x,
- fullY1 + 1 + off_y);
- }
- }
- pbox++;
- }
+ x1 + off_x, y + off_y,
+ x2 + off_x, y + 1 + off_y);
+ pbox++;
}
}
(*uxa_screen->info->done_solid) (dst_pixmap);
@@ -290,16 +122,18 @@ uxa_do_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
if (format != ZPixmap || bpp < 8)
return FALSE;
- /* Only accelerate copies: no rop or planemask. */
- if (!UXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
return FALSE;
- if (uxa_screen->swappedOut)
+ if (!uxa_screen->info->put_image)
return FALSE;
- pPix = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
+ /* Only accelerate copies: no rop or planemask. */
+ if (!UXA_PM_IS_SOLID(pDrawable, pGC->planemask) || pGC->alu != GXcopy)
+ return FALSE;
- if (!pPix || !uxa_screen->info->put_image)
+ pPix = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
+ if (!pPix)
return FALSE;
x += pDrawable->x;
@@ -510,6 +344,9 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable,
int dst_off_x, dst_off_y;
PixmapPtr pSrcPixmap, pDstPixmap;
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
+ goto fallback;
+
pSrcPixmap = uxa_get_drawable_pixmap(pSrcDrawable);
pDstPixmap = uxa_get_drawable_pixmap(pDstDrawable);
if (!pSrcPixmap || !pDstPixmap)
@@ -638,11 +475,13 @@ fallback:
uxa_drawable_location(pSrcDrawable),
uxa_drawable_location(pDstDrawable)));
if (uxa_prepare_access(pDstDrawable, UXA_ACCESS_RW)) {
- if (uxa_prepare_access(pSrcDrawable, UXA_ACCESS_RO)) {
+ if (pSrcDrawable == pDstDrawable ||
+ uxa_prepare_access(pSrcDrawable, UXA_ACCESS_RO)) {
fbCopyNtoN(pSrcDrawable, pDstDrawable, pGC, pbox, nbox,
dx, dy, reverse, upsidedown, bitplane,
closure);
- uxa_finish_access(pSrcDrawable);
+ if (pSrcDrawable != pDstDrawable)
+ uxa_finish_access(pSrcDrawable);
}
uxa_finish_access(pDstDrawable);
}
@@ -654,7 +493,7 @@ uxa_copy_area(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC,
{
uxa_screen_t *uxa_screen = uxa_get_screen(pDstDrawable->pScreen);
- if (uxa_screen->swappedOut) {
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback) {
return uxa_check_copy_area(pSrcDrawable, pDstDrawable, pGC,
srcx, srcy, width, height, dstx,
dsty);
@@ -828,10 +667,7 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
RegionPtr pClip = fbGetCompositeClip(pGC);
PixmapPtr pPixmap;
register BoxPtr pbox;
- BoxPtr pextent;
- int extentX1, extentX2, extentY1, extentY2;
int fullX1, fullX2, fullY1, fullY2;
- int partX1, partX2, partY1, partY2;
int xoff, yoff;
int xorg, yorg;
int n;
@@ -844,7 +680,7 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
if (!REGION_NUM_RECTS(pReg))
goto out;
- if (uxa_screen->swappedOut)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
pPixmap = uxa_get_offscreen_pixmap (pDrawable, &xoff, &yoff);
@@ -893,11 +729,6 @@ fallback:
xorg = pDrawable->x;
yorg = pDrawable->y;
- pextent = REGION_EXTENTS(pGC->pScreen, pClip);
- extentX1 = pextent->x1;
- extentY1 = pextent->y1;
- extentX2 = pextent->x2;
- extentY2 = pextent->y2;
while (nrect--) {
fullX1 = prect->x + xorg;
fullY1 = prect->y + yorg;
@@ -905,62 +736,37 @@ fallback:
fullY2 = fullY1 + (int)prect->height;
prect++;
- if (fullX1 < extentX1)
- fullX1 = extentX1;
-
- if (fullY1 < extentY1)
- fullY1 = extentY1;
-
- if (fullX2 > extentX2)
- fullX2 = extentX2;
+ n = REGION_NUM_RECTS(pClip);
+ pbox = REGION_RECTS(pClip);
+ /*
+ * clip the rectangle to each box in the clip region
+ * this is logically equivalent to calling Intersect(),
+ * but rectangles may overlap each other here.
+ */
+ while (n--) {
+ int x1 = fullX1;
+ int x2 = fullX2;
+ int y1 = fullY1;
+ int y2 = fullY2;
+
+ if (pbox->x1 > x1)
+ x1 = pbox->x1;
+ if (pbox->x2 < x2)
+ x2 = pbox->x2;
+ if (pbox->y1 > y1)
+ y1 = pbox->y1;
+ if (pbox->y2 < y2)
+ y2 = pbox->y2;
+ pbox++;
- if (fullY2 > extentY2)
- fullY2 = extentY2;
+ if (x1 >= x2 || y1 >= y2)
+ continue;
- if ((fullX1 >= fullX2) || (fullY1 >= fullY2))
- continue;
- n = REGION_NUM_RECTS(pClip);
- if (n == 1) {
(*uxa_screen->info->solid) (pPixmap,
- fullX1 + xoff,
- fullY1 + yoff,
- fullX2 + xoff,
- fullY2 + yoff);
- } else {
- pbox = REGION_RECTS(pClip);
- /*
- * clip the rectangle to each box in the clip region
- * this is logically equivalent to calling Intersect(),
- * but rectangles may overlap each other here.
- */
- while (n--) {
- partX1 = pbox->x1;
- if (partX1 < fullX1)
- partX1 = fullX1;
- partY1 = pbox->y1;
- if (partY1 < fullY1)
- partY1 = fullY1;
- partX2 = pbox->x2;
- if (partX2 > fullX2)
- partX2 = fullX2;
- partY2 = pbox->y2;
- if (partY2 > fullY2)
- partY2 = fullY2;
-
- pbox++;
-
- if (partX1 < partX2 && partY1 < partY2) {
- (*uxa_screen->info->solid) (pPixmap,
- partX1 +
- xoff,
- partY1 +
- yoff,
- partX2 +
- xoff,
- partY2 +
- yoff);
- }
- }
+ x1 + xoff,
+ y1 + yoff,
+ x2 + xoff,
+ y2 + yoff);
}
}
(*uxa_screen->info->done_solid) (pPixmap);
@@ -1029,7 +835,7 @@ uxa_fill_region_solid(DrawablePtr pDrawable,
PixmapPtr pixmap;
int xoff, yoff;
int nbox;
- BoxPtr pBox, extents;
+ BoxPtr pBox;
Bool ret = FALSE;
pixmap = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
@@ -1040,101 +846,21 @@ uxa_fill_region_solid(DrawablePtr pDrawable,
nbox = REGION_NUM_RECTS(pRegion);
pBox = REGION_RECTS(pRegion);
- extents = REGION_EXTENTS(screen, pRegion);
-
- /* Using GEM, the relocation costs outweigh the advantages of the blitter */
- if (nbox == 1 || (alu != GXcopy && alu != GXclear) || planemask != FB_ALLONES) {
-try_solid:
- if (uxa_screen->info->check_solid &&
- !uxa_screen->info->check_solid(&pixmap->drawable, alu, planemask))
- goto err;
-
- if (!uxa_screen->info->prepare_solid(pixmap, alu, planemask, pixel))
- goto err;
- while (nbox--) {
- uxa_screen->info->solid(pixmap,
- pBox->x1, pBox->y1,
- pBox->x2, pBox->y2);
- pBox++;
- }
-
- uxa_screen->info->done_solid(pixmap);
- } else {
- PicturePtr dst, src;
- PixmapPtr src_pixmap = NULL;
- xRenderColor color;
- int error;
-
- dst = CreatePicture(0, &pixmap->drawable,
- PictureMatchFormat(screen,
- pixmap->drawable.depth,
- format_for_depth(pixmap->drawable.depth)),
- 0, 0, serverClient, &error);
- if (!dst)
- goto err;
-
- ValidatePicture(dst);
-
- uxa_get_rgba_from_pixel(pixel,
- &color.red,
- &color.green,
- &color.blue,
- &color.alpha,
- format_for_depth(pixmap->drawable.depth));
- src = CreateSolidPicture(0, &color, &error);
- if (!src) {
- FreePicture(dst, 0);
- goto err;
- }
-
- if (!uxa_screen->info->check_composite(PictOpSrc, src, NULL, dst,
- extents->x2 - extents->x1,
- extents->y2 - extents->y1)) {
- FreePicture(src, 0);
- FreePicture(dst, 0);
- goto try_solid;
- }
-
- if (!uxa_screen->info->check_composite_texture ||
- !uxa_screen->info->check_composite_texture(screen, src)) {
- PicturePtr solid;
- int src_off_x, src_off_y;
-
- solid = uxa_acquire_solid(screen, src->pSourcePict);
- FreePicture(src, 0);
-
- src = solid;
- src_pixmap = uxa_get_offscreen_pixmap(src->pDrawable,
- &src_off_x, &src_off_y);
- if (!src_pixmap) {
- FreePicture(src, 0);
- FreePicture(dst, 0);
- goto err;
- }
- }
-
- if (!uxa_screen->info->prepare_composite(PictOpSrc, src, NULL, dst, src_pixmap, NULL, pixmap)) {
- FreePicture(src, 0);
- FreePicture(dst, 0);
- goto err;
- }
+ if (uxa_screen->info->check_solid &&
+ !uxa_screen->info->check_solid(&pixmap->drawable, alu, planemask))
+ goto err;
- while (nbox--) {
- uxa_screen->info->composite(pixmap,
- 0, 0, 0, 0,
- pBox->x1,
- pBox->y1,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1);
- pBox++;
- }
+ if (!uxa_screen->info->prepare_solid(pixmap, alu, planemask, pixel))
+ goto err;
- uxa_screen->info->done_composite(pixmap);
- FreePicture(src, 0);
- FreePicture(dst, 0);
+ while (nbox--) {
+ uxa_screen->info->solid(pixmap,
+ pBox->x1, pBox->y1,
+ pBox->x2, pBox->y2);
+ pBox++;
}
-
+ uxa_screen->info->done_solid(pixmap);
ret = TRUE;
err:
@@ -1257,7 +983,7 @@ uxa_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
Box.x2 = Box.x1 + w;
Box.y2 = Box.y1 + h;
- if (uxa_screen->swappedOut)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
pPix = uxa_get_offscreen_pixmap(pDrawable, &xoff, &yoff);
diff --git a/driver/xf86-video-intel/uxa/uxa-glyphs.c b/driver/xf86-video-intel/uxa/uxa-glyphs.c
index 823cf82f7..6c9ea0d6c 100644
--- a/driver/xf86-video-intel/uxa/uxa-glyphs.c
+++ b/driver/xf86-video-intel/uxa/uxa-glyphs.c
@@ -111,6 +111,9 @@ static void uxa_unrealize_glyph_caches(ScreenPtr pScreen)
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
int i;
+ if (!uxa_screen->glyph_cache_initialized)
+ return;
+
for (i = 0; i < UXA_NUM_GLYPH_CACHE_FORMATS; i++) {
uxa_glyph_cache_t *cache = &uxa_screen->glyphCaches[i];
@@ -120,6 +123,7 @@ static void uxa_unrealize_glyph_caches(ScreenPtr pScreen)
if (cache->glyphs)
free(cache->glyphs);
}
+ uxa_screen->glyph_cache_initialized = FALSE;
}
void uxa_glyphs_fini(ScreenPtr pScreen)
@@ -145,6 +149,10 @@ static Bool uxa_realize_glyph_caches(ScreenPtr pScreen)
};
int i;
+ if (uxa_screen->glyph_cache_initialized)
+ return TRUE;
+
+ uxa_screen->glyph_cache_initialized = TRUE;
memset(uxa_screen->glyphCaches, 0, sizeof(uxa_screen->glyphCaches));
for (i = 0; i < sizeof(formats)/sizeof(formats[0]); i++) {
@@ -164,7 +172,12 @@ static Bool uxa_realize_glyph_caches(ScreenPtr pScreen)
INTEL_CREATE_PIXMAP_TILING_X);
if (!pixmap)
goto bail;
- assert (uxa_pixmap_is_offscreen(pixmap));
+ if (!uxa_pixmap_is_offscreen(pixmap)) {
+ /* Presume shadow is in-effect */
+ pScreen->DestroyPixmap(pixmap);
+ uxa_unrealize_glyph_caches(pScreen);
+ return TRUE;
+ }
component_alpha = NeedsComponent(pPictFormat->format);
picture = CreatePicture(0, &pixmap->drawable, pPictFormat,
@@ -197,13 +210,6 @@ bail:
Bool uxa_glyphs_init(ScreenPtr pScreen)
{
- /* We are trying to initialise per screen resources prior to the
- * complete initialisation of the screen. So ensure the components
- * that we depend upon are initialsed prior to our use.
- */
- if (!CreateScratchPixmapsForScreen(pScreen->myNum))
- return FALSE;
-
#if HAS_DIXREGISTERPRIVATEKEY
if (!dixRegisterPrivateKey(&uxa_glyph_key, PRIVATE_GLYPH, 0))
return FALSE;
@@ -212,10 +218,11 @@ Bool uxa_glyphs_init(ScreenPtr pScreen)
return FALSE;
#endif
- if (!uxa_realize_glyph_caches(pScreen))
- return FALSE;
+ /* Skip pixmap creation if we don't intend to use it. */
+ if (uxa_get_screen(pScreen)->force_fallback)
+ return TRUE;
- return TRUE;
+ return uxa_realize_glyph_caches(pScreen);
}
/* The most efficient thing to way to upload the glyph to the screen
@@ -293,18 +300,19 @@ uxa_glyph_cache_upload_glyph(ScreenPtr screen,
}
void
-uxa_glyph_unrealize(ScreenPtr pScreen,
- GlyphPtr pGlyph)
+uxa_glyph_unrealize(ScreenPtr screen,
+ GlyphPtr glyph)
{
struct uxa_glyph *priv;
- priv = uxa_glyph_get_private(pGlyph);
+ /* Use Lookup in case we have not attached to this glyph. */
+ priv = dixLookupPrivate(&glyph->devPrivates, &uxa_glyph_key);
if (priv == NULL)
return;
priv->cache->glyphs[priv->pos] = NULL;
- uxa_glyph_set_private(pGlyph, NULL);
+ uxa_glyph_set_private(glyph, NULL);
free(priv);
}
@@ -780,9 +788,8 @@ uxa_glyphs_to_dst(CARD8 op,
mask_pixmap =
uxa_get_drawable_pixmap(this_atlas->pDrawable);
- assert (uxa_pixmap_is_offscreen(mask_pixmap));
-
- if (!uxa_screen->info->prepare_composite(op,
+ if (!uxa_pixmap_is_offscreen(mask_pixmap) ||
+ !uxa_screen->info->prepare_composite(op,
localSrc, this_atlas, pDst,
src_pixmap, mask_pixmap, dst_pixmap))
return -1;
@@ -930,6 +937,11 @@ uxa_glyphs_via_mask(CARD8 op,
if (!pixmap)
return 1;
+ if (!uxa_pixmap_is_offscreen(pixmap)) {
+ screen->DestroyPixmap(pixmap);
+ return -1;
+ }
+
uxa_clear_pixmap(screen, uxa_screen, pixmap);
component_alpha = NeedsComponent(maskFormat->format);
@@ -983,9 +995,8 @@ uxa_glyphs_via_mask(CARD8 op,
src_pixmap =
uxa_get_drawable_pixmap(this_atlas->pDrawable);
- assert (uxa_pixmap_is_offscreen(src_pixmap));
-
- if (!uxa_screen->info->prepare_composite(PictOpAdd,
+ if (!uxa_pixmap_is_offscreen(src_pixmap) ||
+ !uxa_screen->info->prepare_composite(PictOpAdd,
this_atlas, NULL, mask,
src_pixmap, NULL, pixmap))
return -1;
@@ -1022,6 +1033,19 @@ next_glyph:
return 0;
}
+static Bool
+is_solid(PicturePtr picture)
+{
+ if (picture->pSourcePict) {
+ SourcePict *source = picture->pSourcePict;
+ return source->type == SourcePictTypeSolidFill;
+ } else {
+ return (picture->repeat &&
+ picture->pDrawable->width == 1 &&
+ picture->pDrawable->height == 1);
+ }
+}
+
void
uxa_glyphs(CARD8 op,
PicturePtr pSrc,
@@ -1040,8 +1064,11 @@ uxa_glyphs(CARD8 op,
if (!uxa_screen->info->prepare_composite ||
uxa_screen->swappedOut ||
+ uxa_screen->force_fallback ||
!uxa_drawable_is_offscreen(pDst->pDrawable) ||
- pDst->alphaMap || pSrc->alphaMap) {
+ pDst->alphaMap || pSrc->alphaMap ||
+ /* XXX we fail to handle (rare) non-solid sources correctly. */
+ !is_solid(pSrc)) {
fallback:
uxa_check_glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
return;
@@ -1122,6 +1149,11 @@ fallback:
if (!pixmap)
return;
+ if (!uxa_pixmap_is_offscreen(pixmap)) {
+ screen->DestroyPixmap(pixmap);
+ goto fallback;
+ }
+
gc = GetScratchGC(depth, screen);
if (!gc) {
screen->DestroyPixmap(pixmap);
diff --git a/driver/xf86-video-intel/uxa/uxa-priv.h b/driver/xf86-video-intel/uxa/uxa-priv.h
index 4b988f4e7..6b9a9c11f 100644
--- a/driver/xf86-video-intel/uxa/uxa-priv.h
+++ b/driver/xf86-video-intel/uxa/uxa-priv.h
@@ -39,7 +39,6 @@
#include "uxa.h"
#include <X11/X.h>
-#define NEED_EVENTS
#include <X11/Xproto.h>
#include "scrnintstr.h"
#include "pixmapstr.h"
@@ -133,12 +132,14 @@ typedef struct {
#endif
EnableDisableFBAccessProcPtr SavedEnableDisableFBAccess;
+ Bool force_fallback;
Bool fallback_debug;
Bool swappedOut;
unsigned disableFbCount;
unsigned offScreenCounter;
uxa_glyph_cache_t glyphCaches[UXA_NUM_GLYPH_CACHE_FORMATS];
+ Bool glyph_cache_initialized;
PicturePtr solid_clear, solid_black, solid_white;
uxa_solid_cache_t solid_cache[UXA_NUM_SOLID_CACHE];
@@ -324,9 +325,11 @@ uxa_check_composite(CARD8 op,
/* uxa.c */
Bool uxa_prepare_access(DrawablePtr pDrawable, uxa_access_t access);
-
void uxa_finish_access(DrawablePtr pDrawable);
+Bool uxa_picture_prepare_access(PicturePtr picture, int mode);
+void uxa_picture_finish_access(PicturePtr picture);
+
void
uxa_get_drawable_deltas(DrawablePtr pDrawable, PixmapPtr pPixmap,
int *xp, int *yp);
diff --git a/driver/xf86-video-intel/uxa/uxa-render.c b/driver/xf86-video-intel/uxa/uxa-render.c
index 056b60a47..076152446 100644
--- a/driver/xf86-video-intel/uxa/uxa-render.c
+++ b/driver/xf86-video-intel/uxa/uxa-render.c
@@ -167,6 +167,10 @@ uxa_print_composite_fallback(const char *func, CARD8 op,
if (! uxa_screen->fallback_debug)
return;
+ /* Limit the noise if fallbacks are expected. */
+ if (uxa_screen->force_fallback)
+ return;
+
uxa_composite_fallback_pict_desc(pSrc, srcdesc, 40);
uxa_composite_fallback_pict_desc(pMask, maskdesc, 40);
uxa_composite_fallback_pict_desc(pDst, dstdesc, 40);
@@ -200,7 +204,10 @@ Bool uxa_op_reads_destination(CARD8 op)
static Bool
uxa_get_pixel_from_rgba(CARD32 * pixel,
CARD16 red,
- CARD16 green, CARD16 blue, CARD16 alpha, CARD32 format)
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 format)
{
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
@@ -225,17 +232,24 @@ uxa_get_pixel_from_rgba(CARD32 * pixel,
gshift = bbits;
rshift = gshift + gbits;
ashift = rshift + rbits;
- } else { /* PICT_TYPE_ABGR */
+ } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
rshift = 0;
gshift = rbits;
bshift = gshift + gbits;
ashift = bshift + bbits;
+ } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
+ ashift = 0;
+ rshift = abits;
+ gshift = rshift + rbits;
+ bshift = gshift + gbits;
+ } else {
+ return FALSE;
}
*pixel = 0;
- *pixel |= (blue >> (16 - bbits)) << bshift;
- *pixel |= (red >> (16 - rbits)) << rshift;
+ *pixel |= (blue >> (16 - bbits)) << bshift;
*pixel |= (green >> (16 - gbits)) << gshift;
+ *pixel |= (red >> (16 - rbits)) << rshift;
*pixel |= (alpha >> (16 - abits)) << ashift;
return TRUE;
@@ -245,7 +259,9 @@ Bool
uxa_get_rgba_from_pixel(CARD32 pixel,
CARD16 * red,
CARD16 * green,
- CARD16 * blue, CARD16 * alpha, CARD32 format)
+ CARD16 * blue,
+ CARD16 * alpha,
+ CARD32 format)
{
int rbits, bbits, gbits, abits;
int rshift, bshift, gshift, ashift;
@@ -267,6 +283,13 @@ uxa_get_rgba_from_pixel(CARD32 pixel,
gshift = rbits;
bshift = gshift + gbits;
ashift = bshift + bbits;
+ } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
+ ashift = 0;
+ rshift = abits;
+ if (abits == 0)
+ rshift = PICT_FORMAT_BPP(format) - (rbits+gbits+bbits);
+ gshift = rshift + rbits;
+ bshift = gshift + gbits;
} else {
return FALSE;
}
@@ -322,11 +345,13 @@ uxa_get_color_for_pixmap (PixmapPtr pixmap,
*pixel = uxa_get_pixmap_first_pixel(pixmap);
if (src_format != dst_format) {
- if (!uxa_get_rgba_from_pixel(*pixel, &red, &green, &blue, &alpha,
+ if (!uxa_get_rgba_from_pixel(*pixel,
+ &red, &green, &blue, &alpha,
src_format))
return FALSE;
- if (!uxa_get_pixel_from_rgba(pixel, red, green, blue, alpha,
+ if (!uxa_get_pixel_from_rgba(pixel,
+ red, green, blue, alpha,
dst_format))
return FALSE;
}
@@ -384,7 +409,23 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
return -1;
}
- pixel = solid->color;
+ if (pDst->format == PICT_a8r8g8b8) {
+ pixel = solid->color;
+ } else if (pDst->format == PICT_x8r8g8b8) {
+ pixel = solid->color | 0xff000000;
+ } else {
+ CARD16 red, green, blue, alpha;
+
+ if (!uxa_get_rgba_from_pixel(solid->color,
+ &red, &green, &blue, &alpha,
+ PICT_a8r8g8b8) ||
+ !uxa_get_pixel_from_rgba(&pixel,
+ red, green, blue, alpha,
+ pDst->format)) {
+ REGION_UNINIT(pDst->pDrawable->pScreen, &region);
+ return -1;
+ }
+ }
}
if (!(*uxa_screen->info->prepare_solid)
@@ -411,12 +452,12 @@ uxa_try_driver_solid_fill(PicturePtr pSrc,
}
static PicturePtr
-uxa_picture_for_pixman_format(ScreenPtr pScreen,
+uxa_picture_for_pixman_format(ScreenPtr screen,
pixman_format_code_t format,
int width, int height)
{
- PicturePtr pPicture;
- PixmapPtr pPixmap;
+ PicturePtr picture;
+ PixmapPtr pixmap;
int error;
if (format == PIXMAN_a1)
@@ -426,24 +467,29 @@ uxa_picture_for_pixman_format(ScreenPtr pScreen,
if (PIXMAN_FORMAT_A(format) == 0)
format = PIXMAN_a8r8g8b8;
- pPixmap = (*pScreen->CreatePixmap)(pScreen, width, height,
- PIXMAN_FORMAT_DEPTH(format),
- UXA_CREATE_PIXMAP_FOR_MAP);
- if (!pPixmap)
+ pixmap = screen->CreatePixmap(screen, width, height,
+ PIXMAN_FORMAT_DEPTH(format),
+ UXA_CREATE_PIXMAP_FOR_MAP);
+ if (!pixmap)
return 0;
- pPicture = CreatePicture(0, &pPixmap->drawable,
- PictureMatchFormat(pScreen,
- PIXMAN_FORMAT_DEPTH(format),
- format),
- 0, 0, serverClient, &error);
- (*pScreen->DestroyPixmap) (pPixmap);
- if (!pPicture)
+ if (!uxa_pixmap_is_offscreen(pixmap)) {
+ screen->DestroyPixmap(pixmap);
+ return 0;
+ }
+
+ picture = CreatePicture(0, &pixmap->drawable,
+ PictureMatchFormat(screen,
+ PIXMAN_FORMAT_DEPTH(format),
+ format),
+ 0, 0, serverClient, &error);
+ screen->DestroyPixmap(pixmap);
+ if (!picture)
return 0;
- ValidatePicture(pPicture);
+ ValidatePicture(picture);
- return pPicture;
+ return picture;
}
static PicturePtr
@@ -514,10 +560,10 @@ uxa_picture_from_pixman_image(ScreenPtr screen,
}
ValidatePicture(src);
- if (uxa_prepare_access(picture->pDrawable, UXA_ACCESS_RW)) {
+ if (uxa_picture_prepare_access(picture, UXA_ACCESS_RW)) {
fbComposite(PictOpSrc, src, NULL, picture,
0, 0, 0, 0, 0, 0, width, height);
- uxa_finish_access(picture->pDrawable);
+ uxa_picture_finish_access(picture);
}
FreePicture(src, 0);
@@ -645,10 +691,10 @@ uxa_acquire_pattern(ScreenPtr pScreen,
if (!pDst)
return 0;
- if (uxa_prepare_access(pDst->pDrawable, UXA_ACCESS_RW)) {
+ if (uxa_picture_prepare_access(pDst, UXA_ACCESS_RW)) {
fbComposite(PictOpSrc, pSrc, NULL, pDst,
x, y, 0, 0, 0, 0, width, height);
- uxa_finish_access(pDst->pDrawable);
+ uxa_picture_finish_access(pDst);
return pDst;
} else {
FreePicture(pDst, 0);
@@ -702,14 +748,14 @@ uxa_render_picture(ScreenPtr screen,
if (!picture)
return 0;
- if (uxa_prepare_access(picture->pDrawable, UXA_ACCESS_RW)) {
- if (uxa_prepare_access(src->pDrawable, UXA_ACCESS_RO)) {
+ if (uxa_picture_prepare_access(picture, UXA_ACCESS_RW)) {
+ if (uxa_picture_prepare_access(src, UXA_ACCESS_RO)) {
ret = 1;
fbComposite(PictOpSrc, src, NULL, picture,
x, y, 0, 0, 0, 0, width, height);
- uxa_finish_access(src->pDrawable);
+ uxa_picture_finish_access(src);
}
- uxa_finish_access(picture->pDrawable);
+ uxa_picture_finish_access(picture);
}
if (!ret) {
@@ -757,6 +803,8 @@ uxa_acquire_drawable(ScreenPtr pScreen,
pDst = uxa_render_picture(pScreen, pSrc,
pSrc->format | (BitsPerPixel(pSrc->pDrawable->depth) << 24),
x, y, width, height);
+ if (!pDst)
+ return 0;
goto done;
} else {
@@ -794,8 +842,10 @@ uxa_acquire_drawable(ScreenPtr pScreen,
PictureMatchFormat(pScreen, depth, pSrc->format),
0, 0, serverClient, &error);
pScreen->DestroyPixmap(pPixmap);
- ValidatePicture(pDst);
+ if (!pDst)
+ return 0;
+ ValidatePicture(pDst);
done:
pDst->componentAlpha = pSrc->componentAlpha;
*out_x = 0;
@@ -945,11 +995,6 @@ uxa_solid_rects (CARD8 op,
return;
}
- /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must
- * manually append the damaged regions ourselves.
- */
- DamageRegionAppend(dst->pDrawable, &region);
-
pixman_region_translate(&region, dst_x, dst_y);
boxes = pixman_region_rectangles(&region, &num_boxes);
extents = pixman_region_extents (&region);
@@ -1013,6 +1058,8 @@ try_solid:
int src_off_x, src_off_y;
solid = uxa_acquire_solid(screen, src->pSourcePict);
+ if (!solid)
+ goto err_src;
FreePicture(src, 0);
src = solid;
@@ -1039,6 +1086,12 @@ try_solid:
FreePicture(src, 0);
}
+ /* XXX xserver-1.8: CompositeRects is not tracked by Damage, so we must
+ * manually append the damaged regions ourselves.
+ */
+ pixman_region_translate(&region, -dst_x, -dst_y);
+ DamageRegionAppend(dst->pDrawable, &region);
+
pixman_region_fini(&region);
return;
@@ -1469,17 +1522,15 @@ uxa_composite(CARD8 op,
RegionRec region;
int tx, ty;
- if (uxa_screen->swappedOut)
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
if (!uxa_drawable_is_offscreen(pDst->pDrawable))
goto fallback;
-
if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
goto fallback;
-
/* Remove repeat in source if useless */
if (pSrc->pDrawable && pSrc->repeat && pSrc->filter != PictFilterConvolution &&
transform_is_integer_translation(pSrc->transform, &tx, &ty) &&
@@ -1705,6 +1756,90 @@ uxa_create_alpha_picture(ScreenPtr pScreen,
return pPicture;
}
+static void
+uxa_check_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc,
+ int ntrap, xTrapezoid * traps)
+{
+ ScreenPtr screen = dst->pDrawable->pScreen;
+
+ if (maskFormat) {
+ PixmapPtr scratch = NULL;
+ PicturePtr mask;
+ INT16 xDst, yDst;
+ INT16 xRel, yRel;
+ BoxRec bounds;
+ int width, height;
+ pixman_image_t *image;
+ pixman_format_code_t format;
+ int error;
+
+ xDst = traps[0].left.p1.x >> 16;
+ yDst = traps[0].left.p1.y >> 16;
+
+ miTrapezoidBounds (ntrap, traps, &bounds);
+ if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
+ return;
+
+ width = bounds.x2 - bounds.x1;
+ height = bounds.y2 - bounds.y1;
+
+ format = maskFormat->format |
+ (BitsPerPixel(maskFormat->depth) << 24);
+ image =
+ pixman_image_create_bits(format, width, height, NULL, 0);
+ if (!image)
+ return;
+
+ for (; ntrap; ntrap--, traps++)
+ pixman_rasterize_trapezoid(image,
+ (pixman_trapezoid_t *) traps,
+ -bounds.x1, -bounds.y1);
+
+
+ scratch = GetScratchPixmapHeader(screen, width, height,
+ PIXMAN_FORMAT_DEPTH(format),
+ PIXMAN_FORMAT_BPP(format),
+ pixman_image_get_stride(image),
+ pixman_image_get_data(image));
+ if (!scratch) {
+ pixman_image_unref(image);
+ return;
+ }
+
+ mask = CreatePicture(0, &scratch->drawable,
+ PictureMatchFormat(screen,
+ PIXMAN_FORMAT_DEPTH(format),
+ format),
+ 0, 0, serverClient, &error);
+ if (!mask) {
+ FreeScratchPixmapHeader(scratch);
+ pixman_image_unref(image);
+ return;
+ }
+
+ xRel = bounds.x1 + xSrc - xDst;
+ yRel = bounds.y1 + ySrc - yDst;
+ CompositePicture(op, src, mask, dst,
+ xRel, yRel,
+ 0, 0,
+ bounds.x1, bounds.y1,
+ width, height);
+ FreePicture(mask, 0);
+
+ FreeScratchPixmapHeader(scratch);
+ pixman_image_unref(image);
+ } else {
+ if (dst->polyEdge == PolyEdgeSharp)
+ maskFormat = PictureMatchFormat(screen, 1, PICT_a1);
+ else
+ maskFormat = PictureMatchFormat(screen, 8, PICT_a8);
+
+ for (; ntrap; ntrap--, traps++)
+ uxa_check_trapezoids(op, src, dst, maskFormat, xSrc, ySrc, 1, traps);
+ }
+}
+
/**
* uxa_trapezoids is essentially a copy of miTrapezoids that uses
* uxa_create_alpha_picture instead of miCreateAlphaPicture.
@@ -1724,9 +1859,15 @@ uxa_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst,
int ntrap, xTrapezoid * traps)
{
ScreenPtr screen = dst->pDrawable->pScreen;
+ uxa_screen_t *uxa_screen = uxa_get_screen(screen);
BoxRec bounds;
Bool direct;
+ if (uxa_screen->swappedOut || uxa_screen->force_fallback) {
+ uxa_check_trapezoids(op, src, dst, maskFormat, xSrc, ySrc, ntrap, traps);
+ return;
+ }
+
direct = op == PictOpAdd && miIsSolidAlpha(src);
if (maskFormat || direct) {
miTrapezoidBounds(ntrap, traps, &bounds);
diff --git a/driver/xf86-video-intel/uxa/uxa-unaccel.c b/driver/xf86-video-intel/uxa/uxa-unaccel.c
index 15be821a0..1d4b2c02e 100644
--- a/driver/xf86-video-intel/uxa/uxa-unaccel.c
+++ b/driver/xf86-video-intel/uxa/uxa-unaccel.c
@@ -67,6 +67,34 @@ void uxa_finish_access_gc(GCPtr pGC)
uxa_finish_access(&pGC->stipple->drawable);
}
+Bool uxa_picture_prepare_access(PicturePtr picture, int mode)
+{
+ if (picture->pDrawable == NULL)
+ return TRUE;
+
+ if (!uxa_prepare_access(picture->pDrawable, mode))
+ return FALSE;
+
+ if (picture->alphaMap &&
+ !uxa_prepare_access(picture->alphaMap->pDrawable, mode)) {
+ uxa_finish_access(picture->pDrawable);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+void uxa_picture_finish_access(PicturePtr picture)
+{
+ if (picture->pDrawable == NULL)
+ return;
+
+ uxa_finish_access(picture->pDrawable);
+ if (picture->alphaMap)
+ uxa_finish_access(picture->alphaMap->pDrawable);
+}
+
+
char uxa_drawable_location(DrawablePtr pDrawable)
{
return uxa_drawable_is_offscreen(pDrawable) ? 's' : 'm';
@@ -362,24 +390,20 @@ uxa_check_composite(CARD8 op,
UXA_FALLBACK(("from picts %p/%p to pict %p\n", pSrc, pMask, pDst));
- if (uxa_prepare_access(pDst->pDrawable, UXA_ACCESS_RW)) {
- if (pSrc->pDrawable == NULL ||
- uxa_prepare_access(pSrc->pDrawable, UXA_ACCESS_RO)) {
- if (!pMask || pMask->pDrawable == NULL ||
- uxa_prepare_access(pMask->pDrawable, UXA_ACCESS_RO))
- {
+ if (uxa_picture_prepare_access(pDst, UXA_ACCESS_RW)) {
+ if (uxa_picture_prepare_access(pSrc, UXA_ACCESS_RO)) {
+ if (!pMask || uxa_picture_prepare_access(pMask, UXA_ACCESS_RO)) {
fbComposite(op, pSrc, pMask, pDst,
xSrc, ySrc,
xMask, yMask,
xDst, yDst,
width, height);
- if (pMask && pMask->pDrawable != NULL)
- uxa_finish_access(pMask->pDrawable);
+ if (pMask)
+ uxa_picture_finish_access(pMask);
}
- if (pSrc->pDrawable != NULL)
- uxa_finish_access(pSrc->pDrawable);
+ uxa_picture_finish_access(pSrc);
}
- uxa_finish_access(pDst->pDrawable);
+ uxa_picture_finish_access(pDst);
}
}
@@ -391,9 +415,9 @@ uxa_check_add_traps(PicturePtr pPicture,
UXA_FALLBACK(("to pict %p (%c)\n", pPicture,
uxa_drawable_location(pPicture->pDrawable)));
- if (uxa_prepare_access(pPicture->pDrawable, UXA_ACCESS_RW)) {
+ if (uxa_picture_prepare_access(pPicture, UXA_ACCESS_RW)) {
fbAddTraps(pPicture, x_off, y_off, ntrap, traps);
- uxa_finish_access(pPicture->pDrawable);
+ uxa_picture_finish_access(pPicture);
}
}
diff --git a/driver/xf86-video-intel/uxa/uxa.c b/driver/xf86-video-intel/uxa/uxa.c
index 37546dc3a..856a0ce5b 100644
--- a/driver/xf86-video-intel/uxa/uxa.c
+++ b/driver/xf86-video-intel/uxa/uxa.c
@@ -1,7 +1,7 @@
/*
- * Copyright © 2001 Keith Packard
+ * Copyright © 2001 Keith Packard
*
- * Partly based on code that is Copyright © The XFree86 Project Inc.
+ * Partly based on code that is Copyright © The XFree86 Project Inc.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
@@ -164,11 +164,12 @@ void uxa_finish_access(DrawablePtr pDrawable)
{
ScreenPtr pScreen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
- PixmapPtr pPixmap = uxa_get_drawable_pixmap(pDrawable);
+ PixmapPtr pPixmap;
if (uxa_screen->info->finish_access == NULL)
return;
+ pPixmap = uxa_get_drawable_pixmap(pDrawable);
if (!uxa_pixmap_is_offscreen(pPixmap))
return;
@@ -354,6 +355,13 @@ void uxa_set_fallback_debug(ScreenPtr screen, Bool enable)
uxa_screen->fallback_debug = enable;
}
+void uxa_set_force_fallback(ScreenPtr screen, Bool value)
+{
+ uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+
+ uxa_screen->force_fallback = value;
+}
+
/**
* uxa_close_screen() unwraps its wrapped screen functions and tears down UXA's
* screen private, before calling down to the next CloseSccreen.
@@ -378,6 +386,16 @@ static Bool uxa_close_screen(int i, ScreenPtr pScreen)
uxa_glyphs_fini(pScreen);
+ if (pScreen->devPrivate) {
+ /* Destroy the pixmap created by miScreenInit() *before*
+ * chaining up as we finalize ourselves here and so this
+ * is the last chance we have of releasing our resources
+ * associated with the Pixmap. So do it first.
+ */
+ (void) (*pScreen->DestroyPixmap) (pScreen->devPrivate);
+ pScreen->devPrivate = NULL;
+ }
+
pScreen->CreateGC = uxa_screen->SavedCreateGC;
pScreen->CloseScreen = uxa_screen->SavedCloseScreen;
pScreen->GetImage = uxa_screen->SavedGetImage;
@@ -481,6 +499,8 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
dixSetPrivate(&screen->devPrivates, &uxa_screen_index, uxa_screen);
+ uxa_screen->force_fallback = FALSE;
+
uxa_screen->solid_cache_size = 0;
uxa_screen->solid_clear = 0;
uxa_screen->solid_black = 0;
diff --git a/driver/xf86-video-intel/uxa/uxa.h b/driver/xf86-video-intel/uxa/uxa.h
index efadfdaaa..e001c53df 100644
--- a/driver/xf86-video-intel/uxa/uxa.h
+++ b/driver/xf86-video-intel/uxa/uxa.h
@@ -571,6 +571,7 @@ uxa_get_color_for_pixmap (PixmapPtr pixmap,
CARD32 *pixel);
void uxa_set_fallback_debug(ScreenPtr screen, Bool enable);
+void uxa_set_force_fallback(ScreenPtr screen, Bool enable);
/**
* Returns TRUE if the given planemask covers all the significant bits in the