Commit ba1b3b53 authored by Zhigang Gong's avatar Zhigang Gong Committed by Emma Anholt
Browse files

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: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent b861aad8
...@@ -79,3 +79,10 @@ extern _X_EXPORT void glamor_egl_free_screen(int scrnIndex, int flags); ...@@ -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 Bool glamor_egl_init_textured_pixmap(ScreenPtr screen);
extern _X_EXPORT void glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap); extern _X_EXPORT void glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap);
#endif #endif
extern _X_EXPORT Bool glamor_fill_spans_nf(DrawablePtr drawable,
GCPtr gc,
int n, DDXPointPtr points,
int *widths, int sorted);
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
Bool Bool
glamor_fill(DrawablePtr drawable, 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); PixmapPtr dst_pixmap = glamor_get_drawable_pixmap(drawable);
int off_x, off_y; int off_x, off_y;
...@@ -80,7 +80,9 @@ glamor_fill(DrawablePtr drawable, ...@@ -80,7 +80,9 @@ glamor_fill(DrawablePtr drawable,
break; break;
} }
return TRUE; return TRUE;
fail: fail:
if (!fallback) return FALSE;
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
if (glamor_prepare_access_gc(gc)) { if (glamor_prepare_access_gc(gc)) {
fbFill(drawable, gc, x, y, width, height); fbFill(drawable, gc, x, y, width, height);
...@@ -89,7 +91,6 @@ glamor_fill(DrawablePtr drawable, ...@@ -89,7 +91,6 @@ glamor_fill(DrawablePtr drawable,
glamor_finish_access(drawable); glamor_finish_access(drawable);
} }
return TRUE; return TRUE;
} }
void void
......
...@@ -30,10 +30,10 @@ ...@@ -30,10 +30,10 @@
*/ */
#include "glamor_priv.h" #include "glamor_priv.h"
void static Bool
glamor_fill_spans(DrawablePtr drawable, _glamor_fill_spans(DrawablePtr drawable,
GCPtr gc, GCPtr gc,
int n, DDXPointPtr points, int *widths, int sorted) int n, DDXPointPtr points, int *widths, int sorted, Bool fallback)
{ {
DDXPointPtr ppt; DDXPointPtr ppt;
int nbox; int nbox;
...@@ -66,12 +66,15 @@ glamor_fill_spans(DrawablePtr drawable, ...@@ -66,12 +66,15 @@ glamor_fill_spans(DrawablePtr drawable,
if (x2 <= x1) if (x2 <= x1)
continue; continue;
glamor_fill(drawable, gc, x1, y, x2 - x1, 1); if (!glamor_fill(drawable, gc, x1, y, x2 - x1, 1, fallback))
goto fail;
pbox++; pbox++;
} }
} }
return; return TRUE;
fail: fail:
if (!fallback) return FALSE;
glamor_fallback("to %p (%c)\n", drawable, glamor_fallback("to %p (%c)\n", drawable,
glamor_get_drawable_location(drawable)); glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
...@@ -82,4 +85,24 @@ glamor_fill_spans(DrawablePtr drawable, ...@@ -82,4 +85,24 @@ glamor_fill_spans(DrawablePtr drawable,
} }
glamor_finish_access(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);
}
...@@ -690,7 +690,7 @@ glamor_glyphs_via_mask(CARD8 op, ...@@ -690,7 +690,7 @@ glamor_glyphs_via_mask(CARD8 op,
} }
gc = GetScratchGC(mask_pixmap->drawable.depth, screen); gc = GetScratchGC(mask_pixmap->drawable.depth, screen);
ValidateGC(&mask_pixmap->drawable, gc); 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); FreeScratchGC(gc);
x = -extents.x1; x = -extents.x1;
y = -extents.y1; y = -extents.y1;
......
...@@ -87,7 +87,7 @@ glamor_poly_fill_rect(DrawablePtr drawable, ...@@ -87,7 +87,7 @@ glamor_poly_fill_rect(DrawablePtr drawable,
if (x1 >= x2 || y1 >= y2) if (x1 >= x2 || y1 >= y2)
continue; continue;
if (!glamor_fill(drawable, gc, x1, y1, x2 - x1, if (!glamor_fill(drawable, gc, x1, y1, x2 - x1,
y2 - y1)) y2 - y1, TRUE))
goto fail; goto fail;
} }
} }
......
...@@ -370,7 +370,7 @@ int glamor_gl_get_version(void); ...@@ -370,7 +370,7 @@ int glamor_gl_get_version(void);
/* glamor_fill.c */ /* glamor_fill.c */
Bool glamor_fill(DrawablePtr drawable, 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, Bool glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
unsigned char alu, unsigned long planemask, unsigned char alu, unsigned long planemask,
unsigned long fg_pixel); unsigned long fg_pixel);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment