summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/intel_uxa.c14
-rw-r--r--uxa/uxa-accel.c88
-rw-r--r--uxa/uxa-glamor.h16
-rw-r--r--uxa/uxa-glyphs.c21
-rw-r--r--uxa/uxa-priv.h8
-rw-r--r--uxa/uxa-render.c90
-rw-r--r--uxa/uxa.c4
7 files changed, 234 insertions, 7 deletions
diff --git a/src/intel_uxa.c b/src/intel_uxa.c
index e4a52706..a79affa4 100644
--- a/src/intel_uxa.c
+++ b/src/intel_uxa.c
@@ -1108,6 +1108,9 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
list_del(&priv->in_flight);
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
intel_set_pixmap_private(pixmap, priv);
+
+ if (!intel_glamor_create_textured_pixmap(pixmap))
+ intel_set_pixmap_bo(pixmap, NULL);
return pixmap;
}
}
@@ -1145,8 +1148,15 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
list_init(&priv->batch);
list_init(&priv->flush);
intel_set_pixmap_private(pixmap, priv);
-
- intel_glamor_create_textured_pixmap(pixmap);
+ /* Create textured pixmap failed means glamor fail to create
+ * a texture from the BO for some reasons, and then glamor
+ * create a new texture attached to the pixmap, and all the
+ * consequent rendering operations on this pixmap will never
+ * fallback to UXA path, so we don't need to hold the useless
+ * BO if it is the case.
+ */
+ if (!intel_glamor_create_textured_pixmap(pixmap))
+ intel_set_pixmap_bo(pixmap, NULL);
}
return pixmap;
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index e4afd137..05c64f6b 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -207,8 +207,23 @@ static void
uxa_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char *bits)
{
+ uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
+
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+ if (glamor_put_image_nf(pDrawable,
+ pGC, depth, x, y, w, h,
+ leftPad, format, bits)) {
+ uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+ return;
+ }
+ uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RO);
+ goto fallback;
+ }
+
if (!uxa_do_put_image(pDrawable, pGC, depth, x, y, w, h, format, bits,
PixmapBytePad(w, pDrawable->depth)))
+fallback:
uxa_check_put_image(pDrawable, pGC, depth, x, y, w, h, leftPad,
format, bits);
}
@@ -352,6 +367,22 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable,
int dst_off_x, dst_off_y;
PixmapPtr pSrcPixmap, pDstPixmap;
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_prepare_access(pSrcDrawable, UXA_GLAMOR_ACCESS_RO);
+ uxa_prepare_access(pDstDrawable, UXA_GLAMOR_ACCESS_RW);
+ if (glamor_copy_n_to_n_nf(pSrcDrawable, pDstDrawable,
+ pGC, pbox, nbox, dx, dy,
+ reverse, upsidedown, bitplane,
+ closure)) {
+ uxa_finish_access(pDstDrawable, UXA_GLAMOR_ACCESS_RW);
+ uxa_finish_access(pSrcDrawable, UXA_GLAMOR_ACCESS_RO);
+ return;
+ }
+ uxa_finish_access(pDstDrawable, UXA_GLAMOR_ACCESS_RO);
+ uxa_finish_access(pSrcDrawable, UXA_GLAMOR_ACCESS_RO);
+ goto fallback;
+ }
+
if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
@@ -795,9 +826,52 @@ out:
REGION_DESTROY(pScreen, pReg);
}
+void
+uxa_get_spans(DrawablePtr pDrawable,
+ int wMax,
+ DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)
+
+{
+ ScreenPtr screen = pDrawable->pScreen;
+ uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+ if (glamor_get_spans_nf(pDrawable, wMax, ppt,
+ pwidth, nspans, pdstStart)) {
+ uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+ return;
+ }
+ uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RO);
+ }
+
+ uxa_check_get_spans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+}
+
+
+static void
+uxa_set_spans(DrawablePtr pDrawable, GCPtr gc, char *src,
+ DDXPointPtr points, int *widths, int n, int sorted)
+{
+ ScreenPtr screen = pDrawable->pScreen;
+ uxa_screen_t *uxa_screen = uxa_get_screen(screen);
+
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+ if (glamor_set_spans_nf(pDrawable, gc, src,
+ points, widths, n, sorted)) {
+ uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+ return;
+ }
+ uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RO);
+ }
+
+ uxa_check_set_spans(pDrawable, gc, src, points, widths, n, sorted);
+}
+
const GCOps uxa_ops = {
uxa_fill_spans,
- uxa_check_set_spans,
+ uxa_set_spans,
uxa_put_image,
uxa_copy_area,
uxa_check_copy_plane,
@@ -1002,6 +1076,18 @@ 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->info->flags & UXA_USE_GLAMOR) {
+ uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+ if (glamor_get_image_nf(pDrawable, x, y, w, h,
+ format, planeMask, d)) {
+ uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
+ return;
+ }
+
+ uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RO);
+ goto fallback;
+ }
+
if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
diff --git a/uxa/uxa-glamor.h b/uxa/uxa-glamor.h
index 2c230987..71a9c292 100644
--- a/uxa/uxa-glamor.h
+++ b/uxa/uxa-glamor.h
@@ -37,8 +37,20 @@
#ifdef USE_GLAMOR
#include "glamor.h"
#else
-#define glamor_fill_spans_nf(...) FALSE
-#define glamor_poly_fill_rect_nf(...) FALSE
+#define glamor_fill_spans_nf(...) FALSE
+#define glamor_poly_fill_rect_nf(...) FALSE
+#define glamor_put_image_nf(...) FALSE
+#define glamor_copy_n_to_n_nf(...) FALSE
+#define glamor_get_spans_nf(...) FALSE
+#define glamor_set_spans_nf(...) FALSE
+#define glamor_get_image_nf(...) FALSE
+#define glamor_glyphs_nf(...) FALSE
+#define glamor_glyph_unrealize(...) ;
+#define glamor_composite_nf(...) FALSE
+#define glamor_composite_rects_nf(...) FALSE
+#define glamor_trapezoids_nf(...) FALSE
+#define glamor_triangles_nf(...) FALSE
+#define glamor_add_traps_nf(...) FALSE
#endif
#endif /* UXA_GLAMOR_H */
diff --git a/uxa/uxa-glyphs.c b/uxa/uxa-glyphs.c
index 6c9ea0d6..2156578e 100644
--- a/uxa/uxa-glyphs.c
+++ b/uxa/uxa-glyphs.c
@@ -65,6 +65,7 @@
#include <stdlib.h>
#include "uxa-priv.h"
+#include "uxa-glamor.h"
#include "../src/common.h"
#include "mipict.h"
@@ -304,6 +305,7 @@ uxa_glyph_unrealize(ScreenPtr screen,
GlyphPtr glyph)
{
struct uxa_glyph *priv;
+ uxa_screen_t *uxa_screen = uxa_get_screen(screen);
/* Use Lookup in case we have not attached to this glyph. */
priv = dixLookupPrivate(&glyph->devPrivates, &uxa_glyph_key);
@@ -314,6 +316,9 @@ uxa_glyph_unrealize(ScreenPtr screen,
uxa_glyph_set_private(glyph, NULL);
free(priv);
+
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR)
+ glamor_glyph_unrealize(screen, glyph);
}
/* Cut and paste from render/glyph.c - probably should export it instead */
@@ -1062,6 +1067,22 @@ uxa_glyphs(CARD8 op,
int width, height, ret;
PicturePtr localDst = pDst;
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_picture_prepare_access(pDst, UXA_GLAMOR_ACCESS_RW);
+ uxa_picture_prepare_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+ if (glamor_glyphs_nf(op,
+ pSrc, pDst, maskFormat,
+ xSrc, ySrc, nlist, list, glyphs)) {
+ uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RW);
+ return;
+ } else {
+ uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RO);
+ goto fallback;
+ }
+ }
+
if (!uxa_screen->info->prepare_composite ||
uxa_screen->swappedOut ||
uxa_screen->force_fallback ||
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index a455f25d..d6d857f1 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -292,6 +292,14 @@ void
uxa_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int format, unsigned long planeMask, char *d);
+void
+uxa_get_spans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart);
+
+void
+uxa_add_traps(PicturePtr pPicture,
+ INT16 x_off, INT16 y_off, int ntrap, xTrap * traps);
+
extern const GCOps uxa_ops;
#ifdef RENDER
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 51c12f17..7d350bce 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -29,6 +29,7 @@
#include <stdlib.h>
#include "uxa-priv.h"
+#include "uxa-glamor.h"
#include <xorgVersion.h>
#ifdef RENDER
@@ -986,6 +987,18 @@ uxa_solid_rects (CARD8 op,
if (!pixman_region_not_empty(dst->pCompositeClip))
return;
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_picture_prepare_access(dst, UXA_GLAMOR_ACCESS_RW);
+ if (glamor_composite_rects_nf(op, dst, color,
+ num_rects, rects)) {
+ uxa_picture_finish_access(dst, UXA_GLAMOR_ACCESS_RW);
+ return;
+ } else {
+ uxa_picture_finish_access(dst, UXA_GLAMOR_ACCESS_RO);
+ goto fallback;
+ }
+ }
+
if (dst->alphaMap)
goto fallback;
@@ -1530,6 +1543,29 @@ uxa_composite(CARD8 op,
RegionRec region;
int tx, ty;
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_picture_prepare_access(pDst, UXA_GLAMOR_ACCESS_RW);
+ uxa_picture_prepare_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+ if (pMask)
+ uxa_picture_prepare_access(pMask, UXA_GLAMOR_ACCESS_RO);
+ if (glamor_composite_nf(op,
+ pSrc, pMask, pDst, xSrc, ySrc,
+ xMask, yMask, xDst, yDst,
+ width, height)) {
+ if (pMask)
+ uxa_picture_finish_access(pMask, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RW);
+ return;
+ } else {
+ if (pMask)
+ uxa_picture_finish_access(pMask, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RO);
+ goto fallback;
+ }
+ }
+
if (uxa_screen->swappedOut || uxa_screen->force_fallback)
goto fallback;
@@ -1871,7 +1907,24 @@ uxa_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst,
BoxRec bounds;
Bool direct;
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_picture_prepare_access(dst, UXA_GLAMOR_ACCESS_RW);
+ uxa_picture_prepare_access(src, UXA_GLAMOR_ACCESS_RO);
+ if (glamor_trapezoids_nf(op,
+ src, dst, maskFormat, xSrc,
+ ySrc, ntrap, traps)) {
+ uxa_picture_finish_access(src, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(dst, UXA_GLAMOR_ACCESS_RW);
+ return;
+ } else {
+ uxa_picture_finish_access(src, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(dst, UXA_GLAMOR_ACCESS_RO);
+ goto fallback;
+ }
+ }
+
if (uxa_screen->swappedOut || uxa_screen->force_fallback) {
+fallback:
uxa_check_trapezoids(op, src, dst, maskFormat, xSrc, ySrc, ntrap, traps);
return;
}
@@ -1995,6 +2048,7 @@ uxa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
int ntri, xTriangle * tris)
{
ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
PictureScreenPtr ps = GetPictureScreen(pScreen);
BoxRec bounds;
Bool direct = op == PictOpAdd && miIsSolidAlpha(pSrc);
@@ -2006,6 +2060,21 @@ uxa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
return;
}
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_picture_prepare_access(pDst, UXA_GLAMOR_ACCESS_RW);
+ uxa_picture_prepare_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+ if (glamor_triangles_nf(op,
+ pSrc, pDst, maskFormat, xSrc,
+ ySrc, ntri, tris)) {
+ uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RW);
+ return;
+ } else {
+ uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
+ uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RO);
+ }
+ }
+
/*
* Check for solid alpha add
*/
@@ -2069,3 +2138,24 @@ uxa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
tris);
}
}
+
+void
+uxa_add_traps(PicturePtr pPicture,
+ INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
+{
+ ScreenPtr pScreen = pPicture->pDrawable->pScreen;
+ uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
+
+ if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
+ uxa_picture_prepare_access(pPicture, UXA_GLAMOR_ACCESS_RW);
+ if (glamor_add_traps_nf(pPicture,
+ x_off, y_off, ntrap, traps)) {
+ uxa_picture_finish_access(pPicture, UXA_GLAMOR_ACCESS_RW);
+ return;
+ } else {
+ uxa_picture_finish_access(pPicture, UXA_GLAMOR_ACCESS_RO);
+ }
+ }
+
+ uxa_check_add_traps(pPicture, x_off, y_off, ntrap, traps);
+}
diff --git a/uxa/uxa.c b/uxa/uxa.c
index 5a3c0bef..5b3d7097 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -521,7 +521,7 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
screen->GetImage = uxa_get_image;
uxa_screen->SavedGetSpans = screen->GetSpans;
- screen->GetSpans = uxa_check_get_spans;
+ screen->GetSpans = uxa_get_spans;
uxa_screen->SavedCopyWindow = screen->CopyWindow;
screen->CopyWindow = uxa_copy_window;
@@ -559,7 +559,7 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
ps->Trapezoids = uxa_trapezoids;
uxa_screen->SavedAddTraps = ps->AddTraps;
- ps->AddTraps = uxa_check_add_traps;
+ ps->AddTraps = uxa_add_traps;
}
}
#endif