uxa: Mega-Glyphs!

Rewrite glyph rendering to avoid the intermediate buffer, accumulating
the glyph rectangles directly in the backend composite routines. And
modify the glyph cache routines to fully utilise the allocated size of
the tiled buffer on older hardware. To do this we alias all glyph sizes
into the same texture using a technique suggested by Keith Packard.

PineView:
  885/856-> 1150/1110 kglyph/s (aa/rgb)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2010-05-29 17:35:00 +01:00
parent d31abccd41
commit 5fff430046
4 changed files with 704 additions and 840 deletions

View File

@ -936,6 +936,7 @@ i830_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
if (depth == 1)
return fbCreatePixmap(screen, w, h, depth, usage);
if (usage == CREATE_PIXMAP_USAGE_GLYPH_PICTURE && w <= 32 && h <= 32)
return fbCreatePixmap(screen, w, h, depth, usage);
@ -1134,6 +1135,9 @@ Bool i830_uxa_init(ScreenPtr screen)
intel->uxa_driver->finish_access = i830_uxa_finish_access;
intel->uxa_driver->pixmap_is_offscreen = i830_uxa_pixmap_is_offscreen;
screen->CreatePixmap = i830_uxa_create_pixmap;
screen->DestroyPixmap = i830_uxa_destroy_pixmap;
if (!uxa_driver_init(screen, intel->uxa_driver)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"UXA initialization failed\n");
@ -1141,9 +1145,6 @@ Bool i830_uxa_init(ScreenPtr screen)
return FALSE;
}
screen->CreatePixmap = i830_uxa_create_pixmap;
screen->DestroyPixmap = i830_uxa_destroy_pixmap;
uxa_set_fallback_debug(screen, intel->fallback_debug);
return TRUE;

File diff suppressed because it is too large Load Diff

View File

@ -103,21 +103,13 @@ char uxa_drawable_location(DrawablePtr pDrawable);
#endif
typedef struct {
/* The identity of the cache, statically configured at initialization */
unsigned int format;
int glyphWidth;
int glyphHeight;
GlyphPtr *glyphs;
int glyphCount; /* Current number of glyphs */
PicturePtr picture; /* Where the glyphs of the cache are stored */
int yOffset; /* y location within the picture where the cache starts */
int columns; /* Number of columns the glyphs are layed out in */
int evictionPosition; /* Next random position to evict a glyph */
GlyphPtr *glyphs;
uint16_t count;
uint16_t evict;
} uxa_glyph_cache_t;
#define UXA_NUM_GLYPH_CACHES 4
#define UXA_NUM_GLYPH_CACHE_FORMATS 2
typedef struct {
uint32_t color;
@ -154,7 +146,7 @@ typedef struct {
unsigned disableFbCount;
unsigned offScreenCounter;
uxa_glyph_cache_t glyphCaches[UXA_NUM_GLYPH_CACHES];
uxa_glyph_cache_t glyphCaches[UXA_NUM_GLYPH_CACHE_FORMATS];
PicturePtr solid_clear, solid_black, solid_white;
uxa_solid_cache_t solid_cache[UXA_NUM_SOLID_CACHE];
@ -445,7 +437,7 @@ uxa_get_rgba_from_pixel(CARD32 pixel,
CARD32 format);
/* uxa_glyph.c */
void uxa_glyphs_init(ScreenPtr pScreen);
Bool uxa_glyphs_init(ScreenPtr pScreen);
void uxa_glyphs_fini(ScreenPtr pScreen);

View File

@ -432,9 +432,6 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
{
uxa_screen_t *uxa_screen;
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
#ifdef RENDER
PictureScreenPtr ps;
#endif
if (!uxa_driver)
return FALSE;
@ -463,10 +460,6 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
"non-NULL\n", screen->myNum);
return FALSE;
}
#ifdef RENDER
ps = GetPictureScreenIfSet(screen);
#endif
uxa_screen = xcalloc(sizeof(uxa_screen_t), 1);
if (!uxa_screen) {
@ -516,27 +509,30 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
scrn->EnableDisableFBAccess = uxa_xorg_enable_disable_fb_access;
#ifdef RENDER
if (ps) {
uxa_screen->SavedComposite = ps->Composite;
ps->Composite = uxa_composite;
{
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
if (ps) {
uxa_screen->SavedComposite = ps->Composite;
ps->Composite = uxa_composite;
uxa_screen->SavedCompositeRects = ps->CompositeRects;
ps->CompositeRects = uxa_solid_rects;
uxa_screen->SavedCompositeRects = ps->CompositeRects;
ps->CompositeRects = uxa_solid_rects;
uxa_screen->SavedGlyphs = ps->Glyphs;
ps->Glyphs = uxa_glyphs;
uxa_screen->SavedGlyphs = ps->Glyphs;
ps->Glyphs = uxa_glyphs;
uxa_screen->SavedUnrealizeGlyph = ps->UnrealizeGlyph;
ps->UnrealizeGlyph = uxa_glyph_unrealize;
uxa_screen->SavedUnrealizeGlyph = ps->UnrealizeGlyph;
ps->UnrealizeGlyph = uxa_glyph_unrealize;
uxa_screen->SavedTriangles = ps->Triangles;
ps->Triangles = uxa_triangles;
uxa_screen->SavedTriangles = ps->Triangles;
ps->Triangles = uxa_triangles;
uxa_screen->SavedTrapezoids = ps->Trapezoids;
ps->Trapezoids = uxa_trapezoids;
uxa_screen->SavedTrapezoids = ps->Trapezoids;
ps->Trapezoids = uxa_trapezoids;
uxa_screen->SavedAddTraps = ps->AddTraps;
ps->AddTraps = uxa_check_add_traps;
uxa_screen->SavedAddTraps = ps->AddTraps;
ps->AddTraps = uxa_check_add_traps;
}
}
#endif
@ -548,7 +544,8 @@ Bool uxa_driver_init(ScreenPtr screen, uxa_driver_t * uxa_driver)
ShmRegisterFuncs(screen, &uxa_shm_funcs);
#endif
uxa_glyphs_init(screen);
if (!uxa_glyphs_init(screen))
return FALSE;
LogMessage(X_INFO,
"UXA(%d): Driver registered support for the following"