summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhigang Gong <zhigang.gong@linux.intel.com>2011-11-09 16:09:03 +0800
committerZhigang Gong <zhigang.gong@linux.intel.com>2011-11-11 14:50:11 +0800
commit114bb7359db9d5dfb074dce94eb06d25ffcddd72 (patch)
tree04f8472bd6fa15c3087e7a8a4920a69b46de2b3d
parent584e8d59cd4ed184ed7eef2a110bce3eea834620 (diff)
Add new version glamor_fillspans without internal fallback.
For the purpose of incrementally intergration of existing intel driver, for the GC operations we may don't want to use glamor's internal fallback which is in general much slower than the implementation in intel driver. If the parameter "fallback" is false when call the glamor_fillspans, then if glamor found it can't accelerate it then it will just return a FALSE rather than fallback to a slow path. Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
-rw-r--r--src/glamor.h7
-rw-r--r--src/glamor_fill.c5
-rw-r--r--src/glamor_fillspans.c33
-rw-r--r--src/glamor_glyphs.c2
-rw-r--r--src/glamor_polyfillrect.c2
-rw-r--r--src/glamor_priv.h2
6 files changed, 41 insertions, 10 deletions
diff --git a/src/glamor.h b/src/glamor.h
index f9da4ad..e98d7d5 100644
--- a/src/glamor.h
+++ b/src/glamor.h
@@ -79,3 +79,10 @@ extern _X_EXPORT void glamor_egl_free_screen(int scrnIndex, int flags);
extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen);
extern _X_EXPORT void glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap);
#endif
+
+extern _X_EXPORT Bool glamor_fill_spans_nf(DrawablePtr drawable,
+ GCPtr gc,
+ int n, DDXPointPtr points,
+ int *widths, int sorted);
+
+
diff --git a/src/glamor_fill.c b/src/glamor_fill.c
index 7a43251..5fc350b 100644
--- a/src/glamor_fill.c
+++ b/src/glamor_fill.c
@@ -34,7 +34,7 @@
Bool
glamor_fill(DrawablePtr drawable,
- GCPtr gc, int x, int y, int width, int height)
+ GCPtr gc, int x, int y, int width, int height, Bool fallback)
{
PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(drawable);
int off_x, off_y;
@@ -80,7 +80,9 @@ glamor_fill(DrawablePtr drawable,
break;
}
return TRUE;
+
fail:
+ if (!fallback) return FALSE;
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access_gc(gc)) {
fbFill(drawable, gc, x, y, width, height);
@@ -89,7 +91,6 @@ glamor_fill(DrawablePtr drawable,
glamor_finish_access(drawable);
}
return TRUE;
-
}
void
diff --git a/src/glamor_fillspans.c b/src/glamor_fillspans.c
index a91e6a9..996f0c5 100644
--- a/src/glamor_fillspans.c
+++ b/src/glamor_fillspans.c
@@ -30,10 +30,10 @@
*/
#include "glamor_priv.h"
-void
-glamor_fill_spans(DrawablePtr drawable,
+static Bool
+_glamor_fill_spans(DrawablePtr drawable,
GCPtr gc,
- int n, DDXPointPtr points, int *widths, int sorted)
+ int n, DDXPointPtr points, int *widths, int sorted, Bool fallback)
{
DDXPointPtr ppt;
int nbox;
@@ -66,12 +66,15 @@ glamor_fill_spans(DrawablePtr drawable,
if (x2 <= x1)
continue;
- glamor_fill(drawable, gc, x1, y, x2 - x1, 1);
+ if (!glamor_fill(drawable, gc, x1, y, x2 - x1, 1, fallback))
+ goto fail;
pbox++;
}
}
- return;
+ return TRUE;
+
fail:
+ if (!fallback) return FALSE;
glamor_fallback("to %p (%c)\n", drawable,
glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
@@ -82,4 +85,24 @@ glamor_fill_spans(DrawablePtr drawable,
}
glamor_finish_access(drawable);
}
+ return TRUE;
}
+
+
+void
+glamor_fill_spans(DrawablePtr drawable,
+ GCPtr gc,
+ int n, DDXPointPtr points, int *widths, int sorted)
+{
+ _glamor_fill_spans(drawable, gc, n, points, widths, sorted, TRUE);
+}
+
+Bool
+glamor_fill_spans_nf(DrawablePtr drawable,
+ GCPtr gc,
+ int n, DDXPointPtr points, int *widths, int sorted)
+{
+ return _glamor_fill_spans(drawable, gc, n, points, widths, sorted, FALSE);
+}
+
+
diff --git a/src/glamor_glyphs.c b/src/glamor_glyphs.c
index 899dd9d..335540d 100644
--- a/src/glamor_glyphs.c
+++ b/src/glamor_glyphs.c
@@ -690,7 +690,7 @@ glamor_glyphs_via_mask(CARD8 op,
}
gc = GetScratchGC(mask_pixmap->drawable.depth, screen);
ValidateGC(&mask_pixmap->drawable, gc);
- glamor_fill(&mask_pixmap->drawable, gc, 0, 0, width, height);
+ glamor_fill(&mask_pixmap->drawable, gc, 0, 0, width, height, TRUE);
FreeScratchGC(gc);
x = -extents.x1;
y = -extents.y1;
diff --git a/src/glamor_polyfillrect.c b/src/glamor_polyfillrect.c
index 762dfc2..eff63b6 100644
--- a/src/glamor_polyfillrect.c
+++ b/src/glamor_polyfillrect.c
@@ -87,7 +87,7 @@ glamor_poly_fill_rect(DrawablePtr drawable,
if (x1 >= x2 || y1 >= y2)
continue;
if (!glamor_fill(drawable, gc, x1, y1, x2 - x1,
- y2 - y1))
+ y2 - y1, TRUE))
goto fail;
}
}
diff --git a/src/glamor_priv.h b/src/glamor_priv.h
index 66c4359..a40a508 100644
--- a/src/glamor_priv.h
+++ b/src/glamor_priv.h
@@ -370,7 +370,7 @@ int glamor_gl_get_version(void);
/* glamor_fill.c */
Bool glamor_fill(DrawablePtr drawable,
- GCPtr gc, int x, int y, int width, int height);
+ GCPtr gc, int x, int y, int width, int height, Bool fallback);
Bool glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask,
unsigned long fg_pixel);