Commit 8c7fcefb authored by Zhigang Gong's avatar Zhigang Gong Committed by Eric Anholt

glamor-for-ddx: Exports all rendering/drawing functions.

This commit exports all the rest rendering/drawing functions
to the DDX drivers. And introduce some new pixmap type. For
a pixmap which has a separated texture, we never fallback
it to the DDX layer.

This commit also adds the following new functions:
glamor_composite_rects, glamor_get_image_nf which are needed
by UXA framework. Just a simple wrapper function of miXXX.
Will consider to optimize them next few weeks.

This commit also Fixed a glyphs rendering bug pointed by Chris.
Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent f7539d9b
...@@ -34,11 +34,13 @@ libglamor_la_SOURCES = \ ...@@ -34,11 +34,13 @@ libglamor_la_SOURCES = \
glamor_setspans.c \ glamor_setspans.c \
glamor_render.c \ glamor_render.c \
glamor_tile.c \ glamor_tile.c \
glamor_triangles.c\ glamor_triangles.c\
glamor_pixmap.c\ glamor_addtraps.c\
glamor_picture.c\ glamor_getimage.c\
glamor_pixmap.c\
glamor_picture.c\
glamor_window.c\ glamor_window.c\
glamor_gl_dispatch.c\ glamor_gl_dispatch.c\
glamor.h glamor.h
sdk_HEADERS = glamor.h sdk_HEADERS = glamor.h
......
...@@ -374,7 +374,7 @@ glamor_init(ScreenPtr screen, unsigned int flags) ...@@ -374,7 +374,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
screen->GetSpans = glamor_get_spans; screen->GetSpans = glamor_get_spans;
glamor_priv->saved_get_image = screen->GetImage; glamor_priv->saved_get_image = screen->GetImage;
screen->GetImage = miGetImage; screen->GetImage = glamor_get_image;
glamor_priv->saved_change_window_attributes = glamor_priv->saved_change_window_attributes =
screen->ChangeWindowAttributes; screen->ChangeWindowAttributes;
...@@ -402,6 +402,9 @@ glamor_init(ScreenPtr screen, unsigned int flags) ...@@ -402,6 +402,9 @@ glamor_init(ScreenPtr screen, unsigned int flags)
glamor_priv->saved_triangles = ps->Triangles; glamor_priv->saved_triangles = ps->Triangles;
ps->Triangles = glamor_triangles; ps->Triangles = glamor_triangles;
glamor_priv->saved_addtraps = ps->AddTraps;
ps->AddTraps = glamor_add_traps;
glamor_priv->saved_unrealize_glyph = ps->UnrealizeGlyph; glamor_priv->saved_unrealize_glyph = ps->UnrealizeGlyph;
ps->UnrealizeGlyph = glamor_glyph_unrealize; ps->UnrealizeGlyph = glamor_glyph_unrealize;
} }
......
...@@ -41,9 +41,30 @@ ...@@ -41,9 +41,30 @@
#endif /* GLAMOR_H */ #endif /* GLAMOR_H */
/* @GLAMOR_INVERTED_Y_AXIS:
* set 1 means the GL env's origin (0,0) is at top-left.
* EGL/DRM platform is an example need to set this bit.
* glx platform's origin is at bottom-left thus need to
* clear this bit.*/
#define GLAMOR_INVERTED_Y_AXIS 1 #define GLAMOR_INVERTED_Y_AXIS 1
/* @GLAMOR_USE_SCREEN:
* If want to let glamor to do everything including the
* create/destroy pixmap and handle the gc ops. need to
* set this bit. Standalone glamor DDX driver need to set
* this bit.
* Otherwise, need to clear this bit, as the intel video
* driver with glamor enabled.
* */
#define GLAMOR_USE_SCREEN 2 #define GLAMOR_USE_SCREEN 2
/* @GLAMOR_USE_PICTURE_SCREEN:
* If want to let glamor to do all the composition related
* things, need to set this bit. Just as standalone glamor
* DDX driver.
* Otherwise, need to clear this bit, as the intel video
* driver with glamor enabled.
*/
#define GLAMOR_USE_PICTURE_SCREEN 4 #define GLAMOR_USE_PICTURE_SCREEN 4
#define GLAMOR_VALID_FLAGS (GLAMOR_INVERTED_Y_AXIS \ #define GLAMOR_VALID_FLAGS (GLAMOR_INVERTED_Y_AXIS \
...@@ -54,12 +75,16 @@ ...@@ -54,12 +75,16 @@
* glamor_pixmap_type : glamor pixmap's type. * glamor_pixmap_type : glamor pixmap's type.
* @MEMORY: pixmap is in memory. * @MEMORY: pixmap is in memory.
* @TEXTURE_DRM: pixmap is in a texture created from a DRM buffer. * @TEXTURE_DRM: pixmap is in a texture created from a DRM buffer.
* @SEPARATE_TEXTURE: The texture is created from a DRM buffer, but
* the format is incompatible, so this type of pixmap
* will never fallback to DDX layer.
* @DRM_ONLY: pixmap is in a external DRM buffer. * @DRM_ONLY: pixmap is in a external DRM buffer.
* @TEXTURE_ONLY: pixmap is in an internal texture. * @TEXTURE_ONLY: pixmap is in an internal texture.
*/ */
typedef enum glamor_pixmap_type { typedef enum glamor_pixmap_type {
GLAMOR_MEMORY, GLAMOR_MEMORY,
GLAMOR_TEXTURE_DRM, GLAMOR_TEXTURE_DRM,
GLAMOR_SEPARATE_TEXTURE,
GLAMOR_DRM_ONLY, GLAMOR_DRM_ONLY,
GLAMOR_TEXTURE_ONLY GLAMOR_TEXTURE_ONLY
} glamor_pixmap_type_t; } glamor_pixmap_type_t;
...@@ -96,6 +121,11 @@ extern _X_EXPORT Bool glamor_egl_init_textured_pixmap(ScreenPtr screen); ...@@ -96,6 +121,11 @@ 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
/* Glamor rendering/drawing functions with XXX_nf.
* nf means no fallback within glamor internal if possible. If glamor
* fail to accelerate the operation, glamor will return a false, and the
* caller need to implement fallback method. Return a true means the
* rendering request get done successfully. */
extern _X_EXPORT Bool glamor_fill_spans_nf(DrawablePtr drawable, extern _X_EXPORT Bool glamor_fill_spans_nf(DrawablePtr drawable,
GCPtr gc, GCPtr gc,
int n, DDXPointPtr points, int n, DDXPointPtr points,
...@@ -157,4 +187,22 @@ extern _X_EXPORT Bool glamor_triangles_nf(CARD8 op, ...@@ -157,4 +187,22 @@ extern _X_EXPORT Bool glamor_triangles_nf(CARD8 op,
extern _X_EXPORT void glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph); extern _X_EXPORT void glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph);
extern _X_EXPORT Bool glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc, char *src,
DDXPointPtr points, int *widths, int n, int sorted);
extern _X_EXPORT Bool glamor_get_spans_nf(DrawablePtr drawable, int wmax,
DDXPointPtr points, int *widths, int count, char *dst);
extern _X_EXPORT Bool glamor_composite_rects_nf (CARD8 op,
PicturePtr pDst,
xRenderColor *color,
int nRect,
xRectangle *rects);
extern _X_EXPORT Bool glamor_get_image_nf(DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int format, unsigned long planeMask, char *d);
extern _X_EXPORT Bool glamor_add_traps_nf(PicturePtr pPicture,
INT16 x_off,
INT16 y_off, int ntrap, xTrap * traps);
/*
* Copyright © 2009 Intel Corporation
* Copyright © 1998 Keith Packard
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* Authors:
* Zhigang Gong <zhigang.gong@gmail.com>
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "glamor_priv.h"
static Bool
_glamor_add_traps(PicturePtr pPicture,
INT16 x_off,
INT16 y_off, int ntrap, xTrap * traps,
Bool fallback)
{
if (!fallback
&& ( !pPicture->pDrawable
|| glamor_ddx_fallback_check_pixmap(pPicture->pDrawable)))
return FALSE;
if (glamor_prepare_access_picture(pPicture, GLAMOR_ACCESS_RW)) {
fbAddTraps(pPicture, x_off, y_off, ntrap, traps);
glamor_finish_access_picture(pPicture, GLAMOR_ACCESS_RW);
}
return TRUE;
}
void
glamor_add_traps(PicturePtr pPicture,
INT16 x_off,
INT16 y_off, int ntrap, xTrap * traps)
{
_glamor_add_traps(pPicture, x_off, y_off, ntrap, traps, TRUE);
}
Bool
glamor_add_traps_nf(PicturePtr pPicture,
INT16 x_off,
INT16 y_off, int ntrap, xTrap * traps)
{
return _glamor_add_traps(pPicture, x_off, y_off, ntrap, traps, FALSE);
}
...@@ -317,15 +317,17 @@ _glamor_copy_n_to_n(DrawablePtr src, ...@@ -317,15 +317,17 @@ _glamor_copy_n_to_n(DrawablePtr src,
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap); src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
screen = dst_pixmap->drawable.pScreen; screen = dst_pixmap->drawable.pScreen;
if (!dst_pixmap_priv || !src_pixmap_priv) if (!dst_pixmap_priv || !GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) {
goto fail;
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dst_pixmap_priv)) {
glamor_fallback("dest pixmap %p has no fbo. \n", glamor_fallback("dest pixmap %p has no fbo. \n",
dst_pixmap); dst_pixmap);
goto fail; goto fail;
} }
if (!src_pixmap_priv) {
glamor_set_pixmap_type(src_pixmap, GLAMOR_MEMORY);
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
}
glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, glamor_get_drawable_deltas(src, src_pixmap, &src_x_off,
&src_y_off); &src_y_off);
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off,
...@@ -398,7 +400,9 @@ _glamor_copy_n_to_n(DrawablePtr src, ...@@ -398,7 +400,9 @@ _glamor_copy_n_to_n(DrawablePtr src,
fail: fail:
if (!fallback) { if (!fallback
&& glamor_ddx_fallback_check_pixmap(src)
&& glamor_ddx_fallback_check_pixmap(dst)) {
ret = FALSE; ret = FALSE;
goto done; goto done;
} }
......
...@@ -65,8 +65,7 @@ ...@@ -65,8 +65,7 @@
static const char glamor_name[] = "glamor"; static const char glamor_name[] = "glamor";
static DevPrivateKeyRec glamor_egl_pixmap_private_key_index; static DevPrivateKeyRec glamor_egl_pixmap_private_key_index;
DevPrivateKey glamor_egl_pixmap_private_key = DevPrivateKey glamor_egl_pixmap_private_key = &glamor_egl_pixmap_private_key_index;
&glamor_egl_pixmap_private_key_index;
static void static void
glamor_identify(int flags) glamor_identify(int flags)
...@@ -121,8 +120,6 @@ _glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl, ...@@ -121,8 +120,6 @@ _glamor_egl_create_image(struct glamor_egl_screen_private *glamor_egl,
EGL_DRM_BUFFER_USE_SCANOUT_MESA, EGL_DRM_BUFFER_USE_SCANOUT_MESA,
EGL_NONE EGL_NONE
}; };
attribs[1] = width; attribs[1] = width;
attribs[3] = height; attribs[3] = height;
attribs[5] = stride; attribs[5] = stride;
...@@ -221,14 +218,15 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) ...@@ -221,14 +218,15 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
EGLImageKHR image; EGLImageKHR image;
GLuint texture; GLuint texture;
int name; int name;
int ret;
glamor_pixmap_type_t type;
if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) { if (!glamor_get_flink_name(glamor_egl->fd, handle, &name)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR, xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Couldn't flink pixmap handle\n"); "Couldn't flink pixmap handle\n");
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY); glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY);
return FALSE; exit(1);
} }
image = _glamor_egl_create_image(glamor_egl, image = _glamor_egl_create_image(glamor_egl,
pixmap->drawable.width, pixmap->drawable.width,
pixmap->drawable.height, pixmap->drawable.height,
...@@ -236,18 +234,41 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride) ...@@ -236,18 +234,41 @@ glamor_egl_create_textured_pixmap(PixmapPtr pixmap, int handle, int stride)
name, name,
pixmap->drawable.depth); pixmap->drawable.depth);
if (image == EGL_NO_IMAGE_KHR) { if (image == EGL_NO_IMAGE_KHR) {
glamor_set_pixmap_type(pixmap, GLAMOR_DRM_ONLY); GLenum format;
return FALSE; /* we have to create separated texture here. The reason is, if
* a DRM-buffer-only pixmap exist, and given a texture only
* pixmap as a source, then we will don't know how to render it
* within glamor, and we even can't find a good way to fallback
* to DDX driver, as DDX driver don't understand a texture only
* pixmap. */
type = GLAMOR_SEPARATE_TEXTURE;
if (pixmap->drawable.depth == 24)
format = GL_RGB;
else
format = GL_RGBA;
glamor_egl->dispatch->glGenTextures(1, &texture);
glamor_egl->dispatch->glBindTexture(GL_TEXTURE_2D, texture);
glamor_egl->dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST);
glamor_egl->dispatch->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
GL_NEAREST);
glamor_egl->dispatch->glTexImage2D(GL_TEXTURE_2D, 0, format, pixmap->drawable.width,
pixmap->drawable.height, 0, format,
GL_UNSIGNED_BYTE, NULL);
ret = FALSE;
} else {
type = GLAMOR_TEXTURE_DRM;
glamor_create_texture_from_image(glamor_egl, image, &texture);
ret = TRUE;
} }
glamor_create_texture_from_image(glamor_egl, image, &texture); glamor_set_pixmap_type(pixmap, type);
glamor_set_pixmap_texture(pixmap, pixmap->drawable.width, glamor_set_pixmap_texture(pixmap, pixmap->drawable.width,
pixmap->drawable.height, texture); pixmap->drawable.height, texture);
glamor_set_pixmap_type(pixmap, GLAMOR_TEXTURE_DRM);
dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key, dixSetPrivate(&pixmap->devPrivates, glamor_egl_pixmap_private_key,
image); image);
return TRUE;
return ret;
} }
void void
...@@ -261,7 +282,7 @@ glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap) ...@@ -261,7 +282,7 @@ glamor_egl_destroy_textured_pixmap(PixmapPtr pixmap)
if (pixmap->refcnt == 1) { if (pixmap->refcnt == 1) {
image = dixLookupPrivate(&pixmap->devPrivates, image = dixLookupPrivate(&pixmap->devPrivates,
glamor_egl_pixmap_private_key); glamor_egl_pixmap_private_key);
if (image != EGL_NO_IMAGE_KHR) if (image != EGL_NO_IMAGE_KHR && image != NULL)
eglDestroyImageKHR(glamor_egl->display, image); eglDestroyImageKHR(glamor_egl->display, image);
} }
glamor_destroy_textured_pixmap(pixmap); glamor_destroy_textured_pixmap(pixmap);
...@@ -357,10 +378,10 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) ...@@ -357,10 +378,10 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd)
xf86Msg(X_INFO, "%s: EGL version %s:\n", glamor_name, version); xf86Msg(X_INFO, "%s: EGL version %s:\n", glamor_name, version);
#define GLAMOR_CHECK_EGL_EXTENSION(EXT) \ #define GLAMOR_CHECK_EGL_EXTENSION(EXT) \
if (!glamor_egl_has_extension(glamor_egl, "EGL_" #EXT)) { \ if (!glamor_egl_has_extension(glamor_egl, "EGL_" #EXT)) { \
ErrorF("EGL_" #EXT "required.\n"); \ ErrorF("EGL_" #EXT "required.\n"); \
return FALSE; \ return FALSE; \
} }
GLAMOR_CHECK_EGL_EXTENSION(MESA_drm_image); GLAMOR_CHECK_EGL_EXTENSION(MESA_drm_image);
GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_renderbuffer_image); GLAMOR_CHECK_EGL_EXTENSION(KHR_gl_renderbuffer_image);
......
...@@ -82,7 +82,12 @@ glamor_fill(DrawablePtr drawable, ...@@ -82,7 +82,12 @@ glamor_fill(DrawablePtr drawable,
return TRUE; return TRUE;
fail: fail:
if (!fallback) return FALSE; if (!fallback) {
if (glamor_ddx_fallback_check_pixmap(&dst_pixmap->drawable)
&& glamor_ddx_fallback_check_gc(gc))
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);
......
...@@ -74,7 +74,10 @@ _glamor_fill_spans(DrawablePtr drawable, ...@@ -74,7 +74,10 @@ _glamor_fill_spans(DrawablePtr drawable,
return TRUE; return TRUE;
fail: fail:
if (!fallback) return FALSE; if (!fallback
&& glamor_ddx_fallback_check_pixmap(drawable)
&& glamor_ddx_fallback_check_gc(gc))
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)) {
......
/*
* Copyright © 2009 Intel Corporation
* Copyright © 1998 Keith Packard
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*
* Authors:
* Zhigang Gong <zhigang.gong@gmail.com>
*
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#include "glamor_priv.h"
static Bool
_glamor_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int format, unsigned long planeMask, char *d,
Bool fallback)
{
miGetImage(pDrawable, x, y, w, h, format, planeMask, d);
return TRUE;
}
void
glamor_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int format, unsigned long planeMask, char *d)
{
_glamor_get_image(pDrawable, x, y, w, h, format, planeMask, d, TRUE);
return;
}
Bool
glamor_get_image_nf(DrawablePtr pDrawable, int x, int y, int w, int h,
unsigned int format, unsigned long planeMask, char *d)
{
return _glamor_get_image(pDrawable, x, y, w,
h, format, planeMask, d, FALSE);
}
...@@ -31,10 +31,11 @@ ...@@ -31,10 +31,11 @@
#include "glamor_priv.h" #include "glamor_priv.h"
void static Bool
glamor_get_spans(DrawablePtr drawable, _glamor_get_spans(DrawablePtr drawable,
int wmax, int wmax,
DDXPointPtr points, int *widths, int count, char *dst) DDXPointPtr points, int *widths, int count, char *dst,
Bool fallback)
{ {
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
GLenum format, type; GLenum format, type;
...@@ -49,7 +50,7 @@ glamor_get_spans(DrawablePtr drawable, ...@@ -49,7 +50,7 @@ glamor_get_spans(DrawablePtr drawable,
uint8_t *readpixels_dst = (uint8_t *) dst; uint8_t *readpixels_dst = (uint8_t *) dst;
int x_off, y_off; int x_off, y_off;
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) { if (!pixmap_priv || !GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
glamor_fallback("pixmap has no fbo.\n"); glamor_fallback("pixmap has no fbo.\n");
goto fail; goto fail;
} }
...@@ -94,14 +95,39 @@ glamor_get_spans(DrawablePtr drawable, ...@@ -94,14 +95,39 @@ glamor_get_spans(DrawablePtr drawable,
} }
if (temp_pixmap) if (temp_pixmap)
glamor_destroy_pixmap(temp_pixmap); glamor_destroy_pixmap(temp_pixmap);
return; return TRUE;
fail: fail:
if (!fallback
&& glamor_ddx_fallback_check_pixmap(drawable))
return FALSE;
glamor_fallback("from %p (%c)\n", drawable, glamor_fallback("from %p (%c)\n", drawable,
glamor_get_drawable_location(drawable)); glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO)) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO)) {
fbGetSpans(drawable, wmax, points, widths, count, dst); fbGetSpans(drawable, wmax, points, widths, count, dst);
glamor_finish_access(drawable, GLAMOR_ACCESS_RO); glamor_finish_access(drawable, GLAMOR_ACCESS_RO);
} }
return TRUE;
} }
void
glamor_get_spans(DrawablePtr drawable,
int wmax,
DDXPointPtr points, int *widths, int count, char *dst)
{
_glamor_get_spans(drawable, wmax, points,
widths, count, dst, TRUE);
}
Bool
glamor_get_spans_nf(DrawablePtr drawable,
int wmax,
DDXPointPtr points, int *widths, int count, char *dst)
{
return _glamor_get_spans(drawable, wmax, points,
widths, count, dst, FALSE);
}
...@@ -184,7 +184,7 @@ glamor_realize_glyph_caches(ScreenPtr pScreen) ...@@ -184,7 +184,7 @@ glamor_realize_glyph_caches(ScreenPtr pScreen)
CPComponentAlpha, &component_alpha, CPComponentAlpha, &component_alpha,
serverClient, &error); serverClient, &error);
glamor_destroy_pixmap(pixmap); pScreen->DestroyPixmap(pixmap);
if (!picture) if (!picture)
goto bail; goto bail;
...@@ -239,12 +239,57 @@ glamor_glyph_cache_upload_glyph(ScreenPtr screen, ...@@ -239,12 +239,57 @@ glamor_glyph_cache_upload_glyph(ScreenPtr screen,
ValidateGC(&pCachePixmap->drawable, gc); ValidateGC(&pCachePixmap->drawable, gc);
scratch = pGlyphPixmap; scratch = pGlyphPixmap;
if (pGlyphPixmap->drawable.depth != pCachePixmap->drawable.depth) {
scratch = glamor_create_pixmap(screen,
glyph->info.width,
glyph->info.height,