diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c index 5afbf3969..431cb4139 100644 --- a/glamor/glamor_core.c +++ b/glamor/glamor_core.c @@ -429,6 +429,42 @@ glamor_finish_access(DrawablePtr drawable) xfree(pixmap->devPrivate.ptr); pixmap->devPrivate.ptr = NULL; } +/** + * Calls uxa_prepare_access with UXA_PREPARE_SRC for the tile, if that is the + * current fill style. + * + * Solid doesn't use an extra pixmap source, so we don't worry about them. + * Stippled/OpaqueStippled are 1bpp and can be in fb, so we should worry + * about them. + */ +Bool +glamor_prepare_access_gc(GCPtr gc) +{ + if (gc->stipple) + if (!glamor_prepare_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO)) + return FALSE; + if (gc->fillStyle == FillTiled) { + if (!glamor_prepare_access (&gc->tile.pixmap->drawable, + GLAMOR_ACCESS_RO)) { + if (gc->stipple) + glamor_finish_access(&gc->stipple->drawable); + return FALSE; + } + } + return TRUE; +} + +/** + * Finishes access to the tile in the GC, if used. + */ +void +glamor_finish_access_gc(GCPtr gc) +{ + if (gc->fillStyle == FillTiled) + glamor_finish_access(&gc->tile.pixmap->drawable); + if (gc->stipple) + glamor_finish_access(&gc->stipple->drawable); +} void glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple, diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index b470be5a4..2045ed691 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -140,6 +140,8 @@ Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access); void glamor_finish_access(DrawablePtr drawable); Bool glamor_prepare_access_window(WindowPtr window); void glamor_finish_access_window(WindowPtr window); +Bool glamor_prepare_access_gc(GCPtr gc); +void glamor_finish_access_gc(GCPtr gc); const Bool glamor_get_drawable_location(const DrawablePtr drawable); Bool glamor_create_gc(GCPtr gc); void glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple,