Merge remote-tracking branch 'anholt/glamor-next'
This commit is contained in:
commit
7088816fee
144
glamor/glamor.c
144
glamor/glamor.c
|
@ -34,6 +34,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "glamor_priv.h"
|
||||
#include "mipict.h"
|
||||
|
||||
DevPrivateKeyRec glamor_screen_private_key;
|
||||
DevPrivateKeyRec glamor_pixmap_private_key;
|
||||
|
@ -59,26 +60,34 @@ glamor_get_drawable_pixmap(DrawablePtr drawable)
|
|||
return (PixmapPtr) drawable;
|
||||
}
|
||||
|
||||
static void
|
||||
glamor_init_pixmap_private_small(PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv)
|
||||
{
|
||||
pixmap_priv->box.x1 = 0;
|
||||
pixmap_priv->box.x2 = pixmap->drawable.width;
|
||||
pixmap_priv->box.y1 = 0;
|
||||
pixmap_priv->box.y2 = pixmap->drawable.height;
|
||||
pixmap_priv->block_w = pixmap->drawable.width;
|
||||
pixmap_priv->block_h = pixmap->drawable.height;
|
||||
pixmap_priv->block_hcnt = 1;
|
||||
pixmap_priv->block_wcnt = 1;
|
||||
pixmap_priv->box_array = &pixmap_priv->box;
|
||||
pixmap_priv->fbo_array = &pixmap_priv->fbo;
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
|
||||
{
|
||||
glamor_pixmap_private *pixmap_priv;
|
||||
glamor_screen_private *glamor_priv =
|
||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||
|
||||
pixmap_priv = dixLookupPrivate(&pixmap->devPrivates,
|
||||
&glamor_pixmap_private_key);
|
||||
if (pixmap_priv == NULL) {
|
||||
pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
|
||||
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
||||
pixmap_priv->base.pixmap = pixmap;
|
||||
pixmap_priv->base.glamor_priv = glamor_priv;
|
||||
}
|
||||
pixmap_priv->type = type;
|
||||
pixmap_priv->base.box.x1 = 0;
|
||||
pixmap_priv->base.box.x2 = pixmap->drawable.width;
|
||||
pixmap_priv->base.box.y1 = 0;
|
||||
pixmap_priv->base.box.y2 = pixmap->drawable.height;
|
||||
glamor_init_pixmap_private_small(pixmap, pixmap_priv);
|
||||
}
|
||||
|
||||
_X_EXPORT void
|
||||
|
@ -93,9 +102,9 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
|
|||
glamor_priv = glamor_get_screen_private(screen);
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
if (pixmap_priv->base.fbo) {
|
||||
if (pixmap_priv->fbo) {
|
||||
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
||||
glamor_destroy_fbo(fbo);
|
||||
glamor_destroy_fbo(glamor_priv, fbo);
|
||||
}
|
||||
|
||||
format = gl_iformat_for_pixmap(pixmap);
|
||||
|
@ -119,10 +128,10 @@ glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap)
|
|||
|
||||
glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
|
||||
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
|
||||
glamor_priv->screen_fbo = pixmap_priv->base.fbo->fb;
|
||||
glamor_priv->screen_fbo = pixmap_priv->fbo->fb;
|
||||
|
||||
pixmap_priv->base.fbo->width = screen_pixmap->drawable.width;
|
||||
pixmap_priv->base.fbo->height = screen_pixmap->drawable.height;
|
||||
pixmap_priv->fbo->width = screen_pixmap->drawable.width;
|
||||
pixmap_priv->fbo->height = screen_pixmap->drawable.height;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
@ -133,7 +142,7 @@ glamor_get_pixmap_texture(PixmapPtr pixmap)
|
|||
if (pixmap_priv->type != GLAMOR_TEXTURE_ONLY)
|
||||
return 0;
|
||||
|
||||
return pixmap_priv->base.fbo->tex;
|
||||
return pixmap_priv->fbo->tex;
|
||||
}
|
||||
|
||||
PixmapPtr
|
||||
|
@ -141,7 +150,6 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
|||
unsigned int usage)
|
||||
{
|
||||
PixmapPtr pixmap;
|
||||
glamor_pixmap_type_t type = GLAMOR_TEXTURE_ONLY;
|
||||
glamor_pixmap_private *pixmap_priv;
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_pixmap_fbo *fbo = NULL;
|
||||
|
@ -169,38 +177,26 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
|
|||
}
|
||||
glamor_set_pixmap_private(pixmap, pixmap_priv);
|
||||
|
||||
if (usage == GLAMOR_CREATE_PIXMAP_MAP)
|
||||
type = GLAMOR_MEMORY_MAP;
|
||||
|
||||
pixmap_priv->base.pixmap = pixmap;
|
||||
pixmap_priv->base.glamor_priv = glamor_priv;
|
||||
|
||||
format = gl_iformat_for_pixmap(pixmap);
|
||||
|
||||
pitch = (((w * pixmap->drawable.bitsPerPixel + 7) / 8) + 3) & ~3;
|
||||
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL);
|
||||
|
||||
if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) {
|
||||
pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
|
||||
pixmap_priv->base.box.x1 = 0;
|
||||
pixmap_priv->base.box.y1 = 0;
|
||||
pixmap_priv->base.box.x2 = w;
|
||||
pixmap_priv->base.box.y2 = h;
|
||||
|
||||
if (usage == GLAMOR_CREATE_PIXMAP_NO_TEXTURE) {
|
||||
glamor_init_pixmap_private_small(pixmap, pixmap_priv);
|
||||
return pixmap;
|
||||
}
|
||||
else if (type == GLAMOR_MEMORY_MAP || usage == GLAMOR_CREATE_NO_LARGE ||
|
||||
else if (usage == GLAMOR_CREATE_NO_LARGE ||
|
||||
glamor_check_fbo_size(glamor_priv, w, h))
|
||||
{
|
||||
pixmap_priv->type = type;
|
||||
pixmap_priv->base.box.x1 = 0;
|
||||
pixmap_priv->base.box.y1 = 0;
|
||||
pixmap_priv->base.box.x2 = w;
|
||||
pixmap_priv->base.box.y2 = h;
|
||||
glamor_init_pixmap_private_small(pixmap, pixmap_priv);
|
||||
fbo = glamor_create_fbo(glamor_priv, w, h, format, usage);
|
||||
} else {
|
||||
int tile_size = glamor_priv->max_fbo_size;
|
||||
DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n", pixmap, w, h, tile_size);
|
||||
pixmap_priv->type = GLAMOR_TEXTURE_LARGE;
|
||||
DEBUGF("Create LARGE pixmap %p width %d height %d, tile size %d\n",
|
||||
pixmap, w, h, tile_size);
|
||||
fbo = glamor_create_fbo_array(glamor_priv, w, h, format, usage,
|
||||
tile_size, tile_size, pixmap_priv);
|
||||
}
|
||||
|
@ -305,6 +301,35 @@ glamor_create_screen_resources(ScreenPtr screen)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static Bool
|
||||
glamor_check_instruction_count(int gl_version)
|
||||
{
|
||||
GLint max_native_alu_instructions;
|
||||
|
||||
/* Avoid using glamor if the reported instructions limit is too low,
|
||||
* as this would cause glamor to fallback on sw due to large shaders
|
||||
* which ends up being unbearably slow.
|
||||
*/
|
||||
if (gl_version < 30) {
|
||||
if (!epoxy_has_gl_extension("GL_ARB_fragment_program")) {
|
||||
ErrorF("GL_ARB_fragment_program required\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB,
|
||||
GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB,
|
||||
&max_native_alu_instructions);
|
||||
if (max_native_alu_instructions < GLAMOR_MIN_ALU_INSTRUCTIONS) {
|
||||
LogMessage(X_WARNING,
|
||||
"glamor requires at least %d instructions (%d reported)\n",
|
||||
GLAMOR_MIN_ALU_INSTRUCTIONS, max_native_alu_instructions);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/** Set up glamor for an already-configured GL context. */
|
||||
Bool
|
||||
glamor_init(ScreenPtr screen, unsigned int flags)
|
||||
|
@ -312,10 +337,8 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
glamor_screen_private *glamor_priv;
|
||||
int gl_version;
|
||||
int max_viewport_size[2];
|
||||
|
||||
#ifdef RENDER
|
||||
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
|
||||
#endif
|
||||
|
||||
if (flags & ~GLAMOR_VALID_FLAGS) {
|
||||
ErrorF("glamor_init: Invalid flags %x\n", flags);
|
||||
return FALSE;
|
||||
|
@ -384,6 +407,9 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
ErrorF("Require OpenGL version 2.1 or later.\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!glamor_check_instruction_count(gl_version))
|
||||
goto fail;
|
||||
} else {
|
||||
if (gl_version < 20) {
|
||||
ErrorF("Require Open GLES2.0 or later.\n");
|
||||
|
@ -411,6 +437,14 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
epoxy_has_gl_extension("GL_ARB_buffer_storage");
|
||||
glamor_priv->has_nv_texture_barrier =
|
||||
epoxy_has_gl_extension("GL_NV_texture_barrier");
|
||||
glamor_priv->has_unpack_subimage =
|
||||
glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP ||
|
||||
epoxy_gl_version() >= 30 ||
|
||||
epoxy_has_gl_extension("GL_EXT_unpack_subimage");
|
||||
glamor_priv->has_pack_subimage =
|
||||
glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP ||
|
||||
epoxy_gl_version() >= 30 ||
|
||||
epoxy_has_gl_extension("GL_NV_pack_subimage");
|
||||
|
||||
glGetIntegerv(GL_MAX_RENDERBUFFER_SIZE, &glamor_priv->max_fbo_size);
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glamor_priv->max_fbo_size);
|
||||
|
@ -442,8 +476,6 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
if (!glamor_font_init(screen))
|
||||
goto fail;
|
||||
|
||||
if (flags & GLAMOR_USE_SCREEN) {
|
||||
|
||||
glamor_priv->saved_procs.block_handler = screen->BlockHandler;
|
||||
screen->BlockHandler = _glamor_block_handler;
|
||||
|
||||
|
@ -471,9 +503,7 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
|
||||
glamor_priv->saved_procs.bitmap_to_region = screen->BitmapToRegion;
|
||||
screen->BitmapToRegion = glamor_bitmap_to_region;
|
||||
}
|
||||
#ifdef RENDER
|
||||
if (flags & GLAMOR_USE_PICTURE_SCREEN) {
|
||||
|
||||
glamor_priv->saved_procs.composite = ps->Composite;
|
||||
ps->Composite = glamor_composite;
|
||||
|
||||
|
@ -486,10 +516,8 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
glamor_priv->saved_procs.addtraps = ps->AddTraps;
|
||||
ps->AddTraps = glamor_add_traps;
|
||||
|
||||
}
|
||||
|
||||
glamor_priv->saved_procs.composite_rects = ps->CompositeRects;
|
||||
ps->CompositeRects = glamor_composite_rectangles;
|
||||
ps->CompositeRects = miCompositeRects;
|
||||
|
||||
glamor_priv->saved_procs.glyphs = ps->Glyphs;
|
||||
ps->Glyphs = glamor_glyphs;
|
||||
|
@ -503,13 +531,14 @@ glamor_init(ScreenPtr screen, unsigned int flags)
|
|||
glamor_priv->saved_procs.destroy_picture = ps->DestroyPicture;
|
||||
ps->DestroyPicture = glamor_destroy_picture;
|
||||
glamor_init_composite_shaders(screen);
|
||||
#endif
|
||||
|
||||
glamor_priv->saved_procs.set_window_pixmap = screen->SetWindowPixmap;
|
||||
screen->SetWindowPixmap = glamor_set_window_pixmap;
|
||||
|
||||
glamor_init_vbo(screen);
|
||||
glamor_init_pixmap_fbo(screen);
|
||||
glamor_init_finish_access_shaders(screen);
|
||||
|
||||
#ifdef GLAMOR_GRADIENT_SHADER
|
||||
glamor_init_gradient_shader(screen);
|
||||
#endif
|
||||
|
@ -532,9 +561,7 @@ glamor_release_screen_priv(ScreenPtr screen)
|
|||
glamor_screen_private *glamor_priv;
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
#ifdef RENDER
|
||||
glamor_fini_composite_shaders(screen);
|
||||
#endif
|
||||
glamor_fini_vbo(screen);
|
||||
glamor_fini_pixmap_fbo(screen);
|
||||
glamor_fini_finish_access_shaders(screen);
|
||||
|
@ -560,8 +587,8 @@ glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv)
|
|||
else {
|
||||
if (old_priv == NULL)
|
||||
return;
|
||||
|
||||
glamor_pixmap_destroy_fbo(old_priv);
|
||||
glamor_pixmap_destroy_fbo(glamor_get_screen_private(pixmap->drawable.pScreen),
|
||||
old_priv);
|
||||
free(old_priv);
|
||||
}
|
||||
|
||||
|
@ -573,19 +600,14 @@ glamor_close_screen(ScreenPtr screen)
|
|||
{
|
||||
glamor_screen_private *glamor_priv;
|
||||
PixmapPtr screen_pixmap;
|
||||
int flags;
|
||||
|
||||
#ifdef RENDER
|
||||
PictureScreenPtr ps = GetPictureScreenIfSet(screen);
|
||||
#endif
|
||||
|
||||
glamor_priv = glamor_get_screen_private(screen);
|
||||
flags = glamor_priv->flags;
|
||||
glamor_sync_close(screen);
|
||||
glamor_glyphs_fini(screen);
|
||||
screen->CloseScreen = glamor_priv->saved_procs.close_screen;
|
||||
screen->CreateScreenResources =
|
||||
glamor_priv->saved_procs.create_screen_resources;
|
||||
if (flags & GLAMOR_USE_SCREEN) {
|
||||
|
||||
screen->CreateGC = glamor_priv->saved_procs.create_gc;
|
||||
screen->CreatePixmap = glamor_priv->saved_procs.create_pixmap;
|
||||
|
@ -596,20 +618,16 @@ glamor_close_screen(ScreenPtr screen)
|
|||
screen->CopyWindow = glamor_priv->saved_procs.copy_window;
|
||||
screen->BitmapToRegion = glamor_priv->saved_procs.bitmap_to_region;
|
||||
screen->BlockHandler = glamor_priv->saved_procs.block_handler;
|
||||
}
|
||||
#ifdef RENDER
|
||||
if (ps && (flags & GLAMOR_USE_PICTURE_SCREEN)) {
|
||||
|
||||
ps->Composite = glamor_priv->saved_procs.composite;
|
||||
ps->Trapezoids = glamor_priv->saved_procs.trapezoids;
|
||||
ps->Triangles = glamor_priv->saved_procs.triangles;
|
||||
ps->CreatePicture = glamor_priv->saved_procs.create_picture;
|
||||
}
|
||||
ps->CompositeRects = glamor_priv->saved_procs.composite_rects;
|
||||
ps->Glyphs = glamor_priv->saved_procs.glyphs;
|
||||
ps->UnrealizeGlyph = glamor_priv->saved_procs.unrealize_glyph;
|
||||
screen->SetWindowPixmap = glamor_priv->saved_procs.set_window_pixmap;
|
||||
#endif
|
||||
|
||||
screen_pixmap = screen->GetScreenPixmap(screen);
|
||||
glamor_set_pixmap_private(screen_pixmap, NULL);
|
||||
|
||||
|
@ -658,7 +676,7 @@ glamor_fd_from_pixmap(ScreenPtr screen,
|
|||
return -1;
|
||||
return glamor_egl_dri3_fd_name_from_tex(screen,
|
||||
pixmap,
|
||||
pixmap_priv->base.fbo->tex,
|
||||
pixmap_priv->fbo->tex,
|
||||
FALSE, stride, size);
|
||||
default:
|
||||
break;
|
||||
|
@ -683,7 +701,7 @@ glamor_name_from_pixmap(PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
|
|||
return -1;
|
||||
return glamor_egl_dri3_fd_name_from_tex(pixmap->drawable.pScreen,
|
||||
pixmap,
|
||||
pixmap_priv->base.fbo->tex,
|
||||
pixmap_priv->fbo->tex,
|
||||
TRUE, stride, size);
|
||||
default:
|
||||
break;
|
||||
|
|
173
glamor/glamor.h
173
glamor/glamor.h
|
@ -53,25 +53,15 @@ struct glamor_context;
|
|||
*/
|
||||
typedef enum glamor_pixmap_type {
|
||||
GLAMOR_MEMORY,
|
||||
GLAMOR_MEMORY_MAP,
|
||||
GLAMOR_TEXTURE_DRM,
|
||||
GLAMOR_SEPARATE_TEXTURE,
|
||||
GLAMOR_DRM_ONLY,
|
||||
GLAMOR_TEXTURE_ONLY,
|
||||
GLAMOR_TEXTURE_LARGE,
|
||||
GLAMOR_TEXTURE_PACK
|
||||
} glamor_pixmap_type_t;
|
||||
|
||||
#define GLAMOR_EGL_EXTERNAL_BUFFER 3
|
||||
#define GLAMOR_INVERTED_Y_AXIS 1 /* compat stub */
|
||||
#define GLAMOR_USE_SCREEN (1 << 1)
|
||||
#define GLAMOR_USE_PICTURE_SCREEN (1 << 2)
|
||||
#define GLAMOR_USE_EGL_SCREEN (1 << 3)
|
||||
#define GLAMOR_NO_DRI3 (1 << 4)
|
||||
#define GLAMOR_VALID_FLAGS (GLAMOR_INVERTED_Y_AXIS \
|
||||
| GLAMOR_USE_SCREEN \
|
||||
| GLAMOR_USE_PICTURE_SCREEN \
|
||||
| GLAMOR_USE_EGL_SCREEN \
|
||||
#define GLAMOR_USE_EGL_SCREEN (1 << 0)
|
||||
#define GLAMOR_NO_DRI3 (1 << 1)
|
||||
#define GLAMOR_VALID_FLAGS (GLAMOR_USE_EGL_SCREEN \
|
||||
| GLAMOR_NO_DRI3)
|
||||
|
||||
/* @glamor_init: Initialize glamor internal data structure.
|
||||
|
@ -79,23 +69,13 @@ typedef enum glamor_pixmap_type {
|
|||
* @screen: Current screen pointer.
|
||||
* @flags: Please refer the flags description above.
|
||||
*
|
||||
* @GLAMOR_USE_SCREEN:
|
||||
* If running in an pre-existing X environment, and the
|
||||
* gl context is GLX, then you should set this bit and
|
||||
* let the glamor to handle all the screen related
|
||||
* functions such as GC ops and CreatePixmap/DestroyPixmap.
|
||||
*
|
||||
* @GLAMOR_USE_PICTURE_SCREEN:
|
||||
* If don't use any other underlying DDX driver to handle
|
||||
* the picture related rendering functions, please set this
|
||||
* bit on. Otherwise, clear this bit. And then it is the DDX
|
||||
* driver's responsibility to determine how/when to jump to
|
||||
* glamor's picture compositing path.
|
||||
*
|
||||
* @GLAMOR_USE_EGL_SCREEN:
|
||||
* If you are using EGL layer, then please set this bit
|
||||
* on, otherwise, clear it.
|
||||
*
|
||||
* @GLAMOR_NO_DRI3
|
||||
* Disable the built-in DRI3 support
|
||||
*
|
||||
* This function initializes necessary internal data structure
|
||||
* for glamor. And before calling into this function, the OpenGL
|
||||
* environment should be ready. Should be called before any real
|
||||
|
@ -142,7 +122,6 @@ extern _X_EXPORT Bool glamor_destroy_pixmap(PixmapPtr pixmap);
|
|||
#define GLAMOR_CREATE_PIXMAP_CPU 0x100
|
||||
#define GLAMOR_CREATE_PIXMAP_FIXUP 0x101
|
||||
#define GLAMOR_CREATE_FBO_NO_FBO 0x103
|
||||
#define GLAMOR_CREATE_PIXMAP_MAP 0x104
|
||||
#define GLAMOR_CREATE_NO_LARGE 0x105
|
||||
#define GLAMOR_CREATE_PIXMAP_NO_TEXTURE 0x106
|
||||
|
||||
|
@ -326,146 +305,6 @@ extern _X_EXPORT void glamor_destroy_gc(GCPtr gc);
|
|||
extern Bool _X_EXPORT glamor_change_window_attributes(WindowPtr pWin, unsigned long mask);
|
||||
extern void _X_EXPORT glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_region);
|
||||
|
||||
/* 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,
|
||||
GCPtr gc,
|
||||
int n, DDXPointPtr points,
|
||||
int *widths, int sorted);
|
||||
|
||||
extern _X_EXPORT Bool glamor_poly_fill_rect_nf(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
int nrect, xRectangle *prect);
|
||||
|
||||
extern _X_EXPORT Bool glamor_put_image_nf(DrawablePtr drawable,
|
||||
GCPtr gc, int depth, int x, int y,
|
||||
int w, int h, int left_pad,
|
||||
int image_format, char *bits);
|
||||
|
||||
extern _X_EXPORT Bool glamor_copy_n_to_n_nf(DrawablePtr src,
|
||||
DrawablePtr dst,
|
||||
GCPtr gc,
|
||||
BoxPtr box,
|
||||
int nbox,
|
||||
int dx,
|
||||
int dy,
|
||||
Bool reverse,
|
||||
Bool upsidedown, Pixel bitplane,
|
||||
void *closure);
|
||||
|
||||
extern _X_EXPORT Bool glamor_copy_nf(DrawablePtr src,
|
||||
DrawablePtr dst,
|
||||
GCPtr gc,
|
||||
BoxPtr box,
|
||||
int nbox,
|
||||
int dx,
|
||||
int dy,
|
||||
Bool reverse,
|
||||
Bool upsidedown, Pixel bitplane,
|
||||
void *closure);
|
||||
|
||||
extern _X_EXPORT Bool glamor_composite_nf(CARD8 op,
|
||||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
INT16 x_source,
|
||||
INT16 y_source,
|
||||
INT16 x_mask,
|
||||
INT16 y_mask,
|
||||
INT16 x_dest, INT16 y_dest,
|
||||
CARD16 width, CARD16 height);
|
||||
|
||||
extern _X_EXPORT Bool glamor_trapezoids_nf(CARD8 op,
|
||||
PicturePtr src, PicturePtr dst,
|
||||
PictFormatPtr mask_format,
|
||||
INT16 x_src, INT16 y_src,
|
||||
int ntrap, xTrapezoid *traps);
|
||||
|
||||
extern _X_EXPORT Bool glamor_glyphs_nf(CARD8 op,
|
||||
PicturePtr src,
|
||||
PicturePtr dst,
|
||||
PictFormatPtr mask_format,
|
||||
INT16 x_src,
|
||||
INT16 y_src, int nlist,
|
||||
GlyphListPtr list, GlyphPtr *glyphs);
|
||||
|
||||
extern _X_EXPORT Bool glamor_triangles_nf(CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pDst,
|
||||
PictFormatPtr maskFormat,
|
||||
INT16 xSrc, INT16 ySrc,
|
||||
int ntris, xTriangle *tris);
|
||||
|
||||
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);
|
||||
|
||||
extern _X_EXPORT Bool glamor_copy_plane_nf(DrawablePtr pSrc, DrawablePtr pDst,
|
||||
GCPtr pGC, int srcx, int srcy, int w,
|
||||
int h, int dstx, int dsty,
|
||||
unsigned long bitPlane,
|
||||
RegionPtr *pRegion);
|
||||
|
||||
extern _X_EXPORT Bool glamor_image_glyph_blt_nf(DrawablePtr pDrawable,
|
||||
GCPtr pGC, int x, int y,
|
||||
unsigned int nglyph,
|
||||
CharInfoPtr *ppci,
|
||||
void *pglyphBase);
|
||||
|
||||
extern _X_EXPORT Bool glamor_poly_glyph_blt_nf(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int x, int y,
|
||||
unsigned int nglyph,
|
||||
CharInfoPtr *ppci,
|
||||
void *pglyphBase);
|
||||
|
||||
extern _X_EXPORT Bool glamor_push_pixels_nf(GCPtr pGC, PixmapPtr pBitmap,
|
||||
DrawablePtr pDrawable, int w, int h,
|
||||
int x, int y);
|
||||
|
||||
extern _X_EXPORT Bool glamor_poly_point_nf(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int mode, int npt, DDXPointPtr ppt);
|
||||
|
||||
extern _X_EXPORT Bool glamor_poly_segment_nf(DrawablePtr pDrawable, GCPtr pGC,
|
||||
int nseg, xSegment *pSeg);
|
||||
|
||||
extern _X_EXPORT Bool glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int mode, int n, DDXPointPtr points);
|
||||
|
||||
extern _X_EXPORT Bool glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, char *chars, int *final_pos);
|
||||
|
||||
extern _X_EXPORT Bool glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, unsigned short *chars, int *final_pos);
|
||||
|
||||
extern _X_EXPORT Bool glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, char *chars);
|
||||
|
||||
extern _X_EXPORT Bool glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, unsigned short *chars);
|
||||
|
||||
#define HAS_GLAMOR_TEXT 1
|
||||
|
||||
#ifdef GLAMOR_FOR_XORG
|
||||
|
|
|
@ -28,34 +28,13 @@
|
|||
|
||||
#include "glamor_priv.h"
|
||||
|
||||
static Bool
|
||||
_glamor_add_traps(PicturePtr pPicture,
|
||||
void
|
||||
glamor_add_traps(PicturePtr pPicture,
|
||||
INT16 x_off,
|
||||
INT16 y_off, int ntrap, xTrap *traps, Bool fallback)
|
||||
INT16 y_off, int ntrap, xTrap *traps)
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ glamor_composite_rectangles(CARD8 op,
|
|||
goto done;
|
||||
}
|
||||
else {
|
||||
if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) {
|
||||
if (_X_LIKELY(glamor_pixmap_priv_is_small(priv))) {
|
||||
int error;
|
||||
|
||||
source = CreateSolidPicture(0, color, &error);
|
||||
|
@ -254,7 +254,7 @@ glamor_composite_rectangles(CARD8 op,
|
|||
goto done;
|
||||
if (glamor_composite_clipped_region(op, source,
|
||||
NULL, dst,
|
||||
NULL, NULL, priv,
|
||||
NULL, NULL, pixmap,
|
||||
®ion, 0, 0, 0, 0, 0, 0))
|
||||
goto done;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ use_copyarea(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
|
|||
glBindTexture(GL_TEXTURE_2D, src->tex);
|
||||
|
||||
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
|
||||
glUniform2f(prog->fill_size_uniform, src->width, src->height);
|
||||
glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ static const glamor_facet glamor_facet_copyarea = {
|
|||
"copy_area",
|
||||
.vs_vars = "attribute vec2 primitive;\n",
|
||||
.vs_exec = (GLAMOR_POS(gl_Position, primitive.xy)
|
||||
" fill_pos = (fill_offset + primitive.xy) / fill_size;\n"),
|
||||
" fill_pos = (fill_offset + primitive.xy) * fill_size_inv;\n"),
|
||||
.fs_exec = " gl_FragColor = texture2D(sampler, fill_pos);\n",
|
||||
.locations = glamor_program_location_fill,
|
||||
.use = use_copyarea,
|
||||
|
@ -71,7 +71,7 @@ use_copyplane(PixmapPtr dst, GCPtr gc, glamor_program *prog, void *arg)
|
|||
glBindTexture(GL_TEXTURE_2D, src->tex);
|
||||
|
||||
glUniform2f(prog->fill_offset_uniform, args->dx, args->dy);
|
||||
glUniform2f(prog->fill_size_uniform, src->width, src->height);
|
||||
glUniform2f(prog->fill_size_inv_uniform, 1.0f/src->width, 1.0f/src->height);
|
||||
|
||||
glamor_set_color(dst, gc->fgPixel, prog->fg_uniform);
|
||||
glamor_set_color(dst, gc->bgPixel, prog->bg_uniform);
|
||||
|
@ -134,7 +134,7 @@ static const glamor_facet glamor_facet_copyplane = {
|
|||
.version = 130,
|
||||
.vs_vars = "attribute vec2 primitive;\n",
|
||||
.vs_exec = (GLAMOR_POS(gl_Position, (primitive.xy))
|
||||
" fill_pos = (fill_offset + primitive.xy) / fill_size;\n"),
|
||||
" fill_pos = (fill_offset + primitive.xy) * fill_size_inv;\n"),
|
||||
.fs_exec = (" uvec4 bits = uvec4(round(texture2D(sampler, fill_pos) * bitmul));\n"
|
||||
" if ((bits & bitplane) != uvec4(0,0,0,0))\n"
|
||||
" gl_FragColor = fg;\n"
|
||||
|
@ -315,7 +315,6 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
|
|||
struct copy_args args;
|
||||
glamor_program *prog;
|
||||
const glamor_facet *copy_facet;
|
||||
Bool set_scissor;
|
||||
int n;
|
||||
|
||||
glamor_make_current(glamor_priv);
|
||||
|
@ -367,8 +366,6 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
|
|||
|
||||
glamor_get_drawable_deltas(src, src_pixmap, &src_off_x, &src_off_y);
|
||||
|
||||
set_scissor = src_priv->type == GLAMOR_TEXTURE_LARGE;
|
||||
if (set_scissor)
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
glamor_pixmap_loop(src_priv, src_box_x, src_box_y) {
|
||||
|
@ -385,30 +382,20 @@ glamor_copy_fbo_fbo_draw(DrawablePtr src,
|
|||
glamor_set_destination_drawable(dst, dst_box_x, dst_box_y, FALSE, FALSE,
|
||||
prog->matrix_uniform, &dst_off_x, &dst_off_y);
|
||||
|
||||
if (set_scissor)
|
||||
glScissor(dst_off_x - args.dx,
|
||||
dst_off_y - args.dy,
|
||||
src_box->x2 - src_box->x1,
|
||||
src_box->y2 - src_box->y1);
|
||||
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
||||
glDrawArrays(GL_QUADS, 0, nbox * 4);
|
||||
else {
|
||||
int i;
|
||||
for (i = 0; i < nbox; i++)
|
||||
glDrawArrays(GL_TRIANGLE_FAN, i*4, 4);
|
||||
glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (set_scissor)
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
return TRUE;
|
||||
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -452,7 +439,6 @@ glamor_copy_fbo_fbo_temp(DrawablePtr src,
|
|||
|
||||
if (!glamor_set_alu(screen, gc ? gc->alu : GXcopy))
|
||||
goto bail_ctx;
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
|
||||
/* Find the size of the area to copy
|
||||
*/
|
||||
|
@ -521,7 +507,6 @@ bail:
|
|||
return FALSE;
|
||||
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -709,39 +694,3 @@ glamor_copy_window(WindowPtr window, DDXPointRec old_origin, RegionPtr src_regio
|
|||
|
||||
RegionUninit(&dst_region);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_copy_n_to_n_nf(DrawablePtr src,
|
||||
DrawablePtr dst,
|
||||
GCPtr gc,
|
||||
BoxPtr box,
|
||||
int nbox,
|
||||
int dx,
|
||||
int dy,
|
||||
Bool reverse,
|
||||
Bool upsidedown, Pixel bitplane,
|
||||
void *closure)
|
||||
{
|
||||
if (glamor_copy_gl(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure))
|
||||
return TRUE;
|
||||
if (glamor_ddx_fallback_check_pixmap(src) && glamor_ddx_fallback_check_pixmap(dst))
|
||||
return FALSE;
|
||||
glamor_copy_bail(src, dst, gc, box, nbox, dx, dy, reverse, upsidedown, bitplane, closure);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_copy_plane_nf(DrawablePtr src, DrawablePtr dst, GCPtr gc,
|
||||
int srcx, int srcy, int w, int h, int dstx, int dsty,
|
||||
unsigned long bitplane, RegionPtr *region)
|
||||
{
|
||||
if (glamor_ddx_fallback_check_pixmap(src) &&
|
||||
glamor_ddx_fallback_check_pixmap(dst) &&
|
||||
glamor_ddx_fallback_check_gc(gc))
|
||||
return FALSE;
|
||||
|
||||
*region = glamor_copy_plane(src, dst, gc,
|
||||
srcx, srcy, w, h, dstx, dsty,
|
||||
bitplane);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -43,9 +43,9 @@ glamor_get_drawable_location(const DrawablePtr drawable)
|
|||
glamor_screen_private *glamor_priv =
|
||||
glamor_get_screen_private(drawable->pScreen);
|
||||
if (pixmap_priv == NULL ||
|
||||
pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED)
|
||||
pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED)
|
||||
return 'm';
|
||||
if (pixmap_priv->base.fbo->fb == glamor_priv->screen_fbo)
|
||||
if (pixmap_priv->fbo->fb == glamor_priv->screen_fbo)
|
||||
return 's';
|
||||
else
|
||||
return 'f';
|
||||
|
@ -173,46 +173,48 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
|
|||
const char *fs_source =
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 color = texture2D(sampler, source_texture);\n"
|
||||
" if (revert == REVERT_NONE) \n"
|
||||
" { \n"
|
||||
" if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != SWAP_NONE_UPLOADING)) \n"
|
||||
" gl_FragColor = texture2D(sampler, source_texture).bgra;\n"
|
||||
" gl_FragColor = color.bgra;\n"
|
||||
" else \n"
|
||||
" gl_FragColor = texture2D(sampler, source_texture).rgba;\n"
|
||||
" gl_FragColor = color.rgba;\n"
|
||||
" } \n"
|
||||
" else \n"
|
||||
" { \n"
|
||||
" if (swap_rb == SWAP_DOWNLOADING) \n"
|
||||
" gl_FragColor = texture2D(sampler, source_texture).argb;\n"
|
||||
" gl_FragColor = color.argb;\n"
|
||||
" else if (swap_rb == SWAP_NONE_DOWNLOADING)\n"
|
||||
" gl_FragColor = texture2D(sampler, source_texture).abgr;\n"
|
||||
" gl_FragColor = color.abgr;\n"
|
||||
" else if (swap_rb == SWAP_UPLOADING)\n"
|
||||
" gl_FragColor = texture2D(sampler, source_texture).gbar;\n"
|
||||
" gl_FragColor = color.gbar;\n"
|
||||
" else if (swap_rb == SWAP_NONE_UPLOADING)\n"
|
||||
" gl_FragColor = texture2D(sampler, source_texture).abgr;\n"
|
||||
" gl_FragColor = color.abgr;\n"
|
||||
" } \n"
|
||||
"}\n";
|
||||
|
||||
const char *set_alpha_source =
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 color = texture2D(sampler, source_texture);\n"
|
||||
" if (revert == REVERT_NONE) \n"
|
||||
" { \n"
|
||||
" if ((swap_rb != SWAP_NONE_DOWNLOADING) && (swap_rb != SWAP_NONE_UPLOADING)) \n"
|
||||
" gl_FragColor = vec4(texture2D(sampler, source_texture).bgr, 1);\n"
|
||||
" gl_FragColor = vec4(color.bgr, 1);\n"
|
||||
" else \n"
|
||||
" gl_FragColor = vec4(texture2D(sampler, source_texture).rgb, 1);\n"
|
||||
" gl_FragColor = vec4(color.rgb, 1);\n"
|
||||
" } \n"
|
||||
" else \n"
|
||||
" { \n"
|
||||
" if (swap_rb == SWAP_DOWNLOADING) \n"
|
||||
" gl_FragColor = vec4(1, texture2D(sampler, source_texture).rgb);\n"
|
||||
" gl_FragColor = vec4(1, color.rgb);\n"
|
||||
" else if (swap_rb == SWAP_NONE_DOWNLOADING)\n"
|
||||
" gl_FragColor = vec4(1, texture2D(sampler, source_texture).bgr);\n"
|
||||
" gl_FragColor = vec4(1, color.bgr);\n"
|
||||
" else if (swap_rb == SWAP_UPLOADING)\n"
|
||||
" gl_FragColor = vec4(texture2D(sampler, source_texture).gba, 1);\n"
|
||||
" gl_FragColor = vec4(color.gba, 1);\n"
|
||||
" else if (swap_rb == SWAP_NONE_UPLOADING)\n"
|
||||
" gl_FragColor = vec4(texture2D(sampler, source_texture).abg, 1);\n"
|
||||
" gl_FragColor = vec4(color.abg, 1);\n"
|
||||
" } \n"
|
||||
"}\n";
|
||||
GLint fs_prog, vs_prog, avs_prog, set_alpha_prog;
|
||||
|
|
|
@ -159,11 +159,11 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
|
|||
&glamor_priv->on_off_dash_line_progs,
|
||||
&glamor_facet_on_off_dash_lines);
|
||||
if (!prog)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
break;
|
||||
case LineDoubleDash:
|
||||
if (gc->fillStyle != FillSolid)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
prog = &glamor_priv->double_dash_line_prog;
|
||||
|
||||
|
@ -171,32 +171,30 @@ glamor_dash_setup(DrawablePtr drawable, GCPtr gc)
|
|||
if (!glamor_build_program(screen, prog,
|
||||
&glamor_facet_double_dash_lines,
|
||||
NULL))
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (!glamor_use_program(pixmap, gc, prog, NULL))
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
glamor_set_color(pixmap, gc->fgPixel, prog->fg_uniform);
|
||||
glamor_set_color(pixmap, gc->bgPixel, prog->bg_uniform);
|
||||
break;
|
||||
|
||||
default:
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
|
||||
/* Set the dash pattern as texture 1 */
|
||||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, dash_priv->base.fbo->tex);
|
||||
glBindTexture(GL_TEXTURE_2D, dash_priv->fbo->tex);
|
||||
glUniform1i(prog->dash_uniform, 1);
|
||||
glUniform1f(prog->dash_length_uniform, dash_pixmap->drawable.width);
|
||||
|
||||
return prog;
|
||||
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
bail:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -230,7 +228,6 @@ glamor_dash_loop(DrawablePtr drawable, GCPtr gc, glamor_program *prog,
|
|||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,6 @@ glamor_egl_create_textured_screen(ScreenPtr screen, int handle, int stride)
|
|||
"Failed to create textured screen.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
glamor_set_screen_pixmap(screen_pixmap, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -272,7 +271,7 @@ glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image)
|
|||
glamor_get_pixmap_private(pixmap);
|
||||
EGLImageKHR old;
|
||||
|
||||
old = pixmap_priv->base.image;
|
||||
old = pixmap_priv->image;
|
||||
if (old) {
|
||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
|
||||
|
@ -280,7 +279,7 @@ glamor_egl_set_pixmap_image(PixmapPtr pixmap, EGLImageKHR image)
|
|||
|
||||
eglDestroyImageKHR(glamor_egl->display, old);
|
||||
}
|
||||
pixmap_priv->base.image = image;
|
||||
pixmap_priv->image = image;
|
||||
}
|
||||
|
||||
Bool
|
||||
|
@ -420,7 +419,7 @@ glamor_egl_dri3_fd_name_from_tex(ScreenPtr screen,
|
|||
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
image = pixmap_priv->base.image;
|
||||
image = pixmap_priv->image;
|
||||
if (!image) {
|
||||
image = eglCreateImageKHR(glamor_egl->display,
|
||||
glamor_egl->context,
|
||||
|
@ -536,7 +535,7 @@ glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
|
|||
struct glamor_pixmap_private *pixmap_priv =
|
||||
glamor_get_pixmap_private(pixmap);
|
||||
|
||||
if (pixmap_priv && pixmap_priv->base.image) {
|
||||
if (pixmap_priv && pixmap_priv->image) {
|
||||
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
|
||||
struct glamor_egl_screen_private *glamor_egl =
|
||||
glamor_egl_get_screen_private(scrn);
|
||||
|
@ -545,8 +544,8 @@ glamor_egl_destroy_pixmap_image(PixmapPtr pixmap)
|
|||
* a texture. we must call glFlush to make sure the
|
||||
* operation on that texture has been done.*/
|
||||
glamor_block_handler(pixmap->drawable.pScreen);
|
||||
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
|
||||
pixmap_priv->base.image = NULL;
|
||||
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
|
||||
pixmap_priv->image = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,13 +560,12 @@ glamor_egl_exchange_buffers(PixmapPtr front, PixmapPtr back)
|
|||
|
||||
glamor_pixmap_exchange_fbos(front, back);
|
||||
|
||||
temp = back_priv->base.image;
|
||||
back_priv->base.image = front_priv->base.image;
|
||||
front_priv->base.image = temp;
|
||||
temp = back_priv->image;
|
||||
back_priv->image = front_priv->image;
|
||||
front_priv->image = temp;
|
||||
|
||||
glamor_set_pixmap_type(front, GLAMOR_TEXTURE_DRM);
|
||||
glamor_set_pixmap_type(back, GLAMOR_TEXTURE_DRM);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -589,8 +587,8 @@ glamor_egl_close_screen(ScreenPtr screen)
|
|||
screen_pixmap = screen->GetScreenPixmap(screen);
|
||||
pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
|
||||
|
||||
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->base.image);
|
||||
pixmap_priv->base.image = NULL;
|
||||
eglDestroyImageKHR(glamor_egl->display, pixmap_priv->image);
|
||||
pixmap_priv->image = NULL;
|
||||
|
||||
screen->CloseScreen = glamor_egl->saved_close_screen;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ cache_hbucket(int size)
|
|||
|
||||
static glamor_pixmap_fbo *
|
||||
glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
|
||||
int w, int h, GLenum format, int flag)
|
||||
int w, int h, GLenum format)
|
||||
{
|
||||
struct xorg_list *cache;
|
||||
glamor_pixmap_fbo *fbo_entry, *ret_fbo = NULL;
|
||||
|
@ -87,21 +87,7 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
|
|||
cache = &glamor_priv->fbo_cache[n_format]
|
||||
[cache_wbucket(w)]
|
||||
[cache_hbucket(h)];
|
||||
if (!(flag & GLAMOR_CACHE_EXACT_SIZE)) {
|
||||
xorg_list_for_each_entry(fbo_entry, cache, list) {
|
||||
if (fbo_entry->width >= w && fbo_entry->height >= h) {
|
||||
|
||||
DEBUGF("Request w %d h %d format %x \n", w, h, format);
|
||||
DEBUGF("got cache entry %p w %d h %d fbo %d tex %d format %x\n",
|
||||
fbo_entry, fbo_entry->width, fbo_entry->height,
|
||||
fbo_entry->fb, fbo_entry->tex);
|
||||
xorg_list_del(&fbo_entry->list);
|
||||
ret_fbo = fbo_entry;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
xorg_list_for_each_entry(fbo_entry, cache, list) {
|
||||
if (fbo_entry->width == w && fbo_entry->height == h) {
|
||||
|
||||
|
@ -115,7 +101,6 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret_fbo)
|
||||
glamor_priv->fbo_cache_watermark -= ret_fbo->width * ret_fbo->height;
|
||||
|
@ -127,9 +112,10 @@ glamor_pixmap_fbo_cache_get(glamor_screen_private *glamor_priv,
|
|||
}
|
||||
|
||||
static void
|
||||
glamor_purge_fbo(glamor_pixmap_fbo *fbo)
|
||||
glamor_purge_fbo(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_fbo *fbo)
|
||||
{
|
||||
glamor_make_current(fbo->glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (fbo->fb)
|
||||
glDeleteFramebuffers(1, &fbo->fb);
|
||||
|
@ -142,7 +128,8 @@ glamor_purge_fbo(glamor_pixmap_fbo *fbo)
|
|||
}
|
||||
|
||||
static void
|
||||
glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
|
||||
glamor_pixmap_fbo_cache_put(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_fbo *fbo)
|
||||
{
|
||||
struct xorg_list *cache;
|
||||
int n_format;
|
||||
|
@ -154,32 +141,33 @@ glamor_pixmap_fbo_cache_put(glamor_pixmap_fbo *fbo)
|
|||
n_format = cache_format(fbo->format);
|
||||
|
||||
if (fbo->fb == 0 || fbo->external || n_format == -1
|
||||
|| fbo->glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) {
|
||||
fbo->glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX;
|
||||
glamor_fbo_expire(fbo->glamor_priv);
|
||||
glamor_purge_fbo(fbo);
|
||||
|| glamor_priv->fbo_cache_watermark >= FBO_CACHE_THRESHOLD) {
|
||||
glamor_priv->tick += GLAMOR_CACHE_EXPIRE_MAX;
|
||||
glamor_fbo_expire(glamor_priv);
|
||||
glamor_purge_fbo(glamor_priv, fbo);
|
||||
return;
|
||||
}
|
||||
|
||||
cache = &fbo->glamor_priv->fbo_cache[n_format]
|
||||
cache = &glamor_priv->fbo_cache[n_format]
|
||||
[cache_wbucket(fbo->width)]
|
||||
[cache_hbucket(fbo->height)];
|
||||
DEBUGF
|
||||
("Put cache entry %p to cache %p w %d h %d format %x fbo %d tex %d \n",
|
||||
fbo, cache, fbo->width, fbo->height, fbo->format, fbo->fb, fbo->tex);
|
||||
|
||||
fbo->glamor_priv->fbo_cache_watermark += fbo->width * fbo->height;
|
||||
glamor_priv->fbo_cache_watermark += fbo->width * fbo->height;
|
||||
xorg_list_add(&fbo->list, cache);
|
||||
fbo->expire = fbo->glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX;
|
||||
fbo->expire = glamor_priv->tick + GLAMOR_CACHE_EXPIRE_MAX;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
glamor_pixmap_ensure_fb(glamor_pixmap_fbo *fbo)
|
||||
glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_fbo *fbo)
|
||||
{
|
||||
int status, err = 0;
|
||||
|
||||
glamor_make_current(fbo->glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (fbo->fb == 0)
|
||||
glGenFramebuffers(1, &fbo->fb);
|
||||
|
@ -239,22 +227,14 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
|
|||
fbo->height = h;
|
||||
fbo->external = FALSE;
|
||||
fbo->format = format;
|
||||
fbo->glamor_priv = glamor_priv;
|
||||
|
||||
if (flag == GLAMOR_CREATE_PIXMAP_MAP) {
|
||||
glamor_make_current(glamor_priv);
|
||||
glGenBuffers(1, &fbo->pbo);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
|
||||
if (glamor_pixmap_ensure_fb(fbo) != 0) {
|
||||
glamor_purge_fbo(fbo);
|
||||
if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) {
|
||||
glamor_purge_fbo(glamor_priv, fbo);
|
||||
fbo = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return fbo;
|
||||
}
|
||||
|
||||
|
@ -280,7 +260,7 @@ glamor_fbo_expire(glamor_screen_private *glamor_priv)
|
|||
xorg_list_del(&fbo_entry->list);
|
||||
DEBUGF("cache %p fbo %p expired %d current %d \n", cache,
|
||||
fbo_entry, fbo_entry->expire, glamor_priv->tick);
|
||||
glamor_purge_fbo(fbo_entry);
|
||||
glamor_purge_fbo(glamor_priv, fbo_entry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,16 +297,17 @@ glamor_fini_pixmap_fbo(ScreenPtr screen)
|
|||
xorg_list_for_each_entry_safe_reverse(fbo_entry, tmp, cache,
|
||||
list) {
|
||||
xorg_list_del(&fbo_entry->list);
|
||||
glamor_purge_fbo(fbo_entry);
|
||||
glamor_purge_fbo(glamor_priv, fbo_entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glamor_destroy_fbo(glamor_pixmap_fbo *fbo)
|
||||
glamor_destroy_fbo(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_fbo *fbo)
|
||||
{
|
||||
xorg_list_del(&fbo->list);
|
||||
glamor_pixmap_fbo_cache_put(fbo);
|
||||
glamor_pixmap_fbo_cache_put(glamor_priv, fbo);
|
||||
|
||||
}
|
||||
|
||||
|
@ -348,7 +329,6 @@ _glamor_create_tex(glamor_screen_private *glamor_priv,
|
|||
glamor_make_current(glamor_priv);
|
||||
glGenTextures(1, &tex);
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, format, w, h, 0,
|
||||
|
@ -363,26 +343,15 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
|
|||
{
|
||||
glamor_pixmap_fbo *fbo;
|
||||
GLint tex = 0;
|
||||
int cache_flag;
|
||||
|
||||
if (flag == GLAMOR_CREATE_FBO_NO_FBO)
|
||||
goto new_fbo;
|
||||
|
||||
if (flag == GLAMOR_CREATE_PIXMAP_MAP)
|
||||
goto no_tex;
|
||||
|
||||
/* Tiling from textures requires exact pixmap sizes. As we don't
|
||||
* know which pixmaps will be used as tiles, just allocate
|
||||
* everything at the requested size
|
||||
*/
|
||||
cache_flag = GLAMOR_CACHE_EXACT_SIZE;
|
||||
|
||||
fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format, cache_flag);
|
||||
fbo = glamor_pixmap_fbo_cache_get(glamor_priv, w, h, format);
|
||||
if (fbo)
|
||||
return fbo;
|
||||
new_fbo:
|
||||
tex = _glamor_create_tex(glamor_priv, w, h, format);
|
||||
no_tex:
|
||||
fbo = glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag);
|
||||
|
||||
return fbo;
|
||||
|
@ -399,9 +368,9 @@ _glamor_create_fbo_array(glamor_screen_private *glamor_priv,
|
|||
glamor_pixmap_fbo **fbo_array;
|
||||
BoxPtr box_array;
|
||||
int i, j;
|
||||
glamor_pixmap_private_large_t *priv;
|
||||
glamor_pixmap_private *priv;
|
||||
|
||||
priv = &pixmap_priv->large;
|
||||
priv = pixmap_priv;
|
||||
|
||||
block_wcnt = (w + block_w - 1) / block_w;
|
||||
block_hcnt = (h + block_h - 1) / block_h;
|
||||
|
@ -438,7 +407,7 @@ _glamor_create_fbo_array(glamor_screen_private *glamor_priv,
|
|||
format,
|
||||
GLAMOR_CREATE_PIXMAP_FIXUP);
|
||||
else
|
||||
fbo_array[i * block_wcnt + j] = priv->base.fbo;
|
||||
fbo_array[i * block_wcnt + j] = priv->fbo;
|
||||
if (fbo_array[i * block_wcnt + j] == NULL)
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -454,7 +423,7 @@ _glamor_create_fbo_array(glamor_screen_private *glamor_priv,
|
|||
cleanup:
|
||||
for (i = 0; i < block_wcnt * block_hcnt; i++)
|
||||
if ((fbo_array)[i])
|
||||
glamor_destroy_fbo((fbo_array)[i]);
|
||||
glamor_destroy_fbo(glamor_priv, (fbo_array)[i]);
|
||||
free(box_array);
|
||||
free(fbo_array);
|
||||
return NULL;
|
||||
|
@ -468,8 +437,8 @@ glamor_create_fbo_array(glamor_screen_private *glamor_priv,
|
|||
int block_w, int block_h,
|
||||
glamor_pixmap_private *pixmap_priv)
|
||||
{
|
||||
pixmap_priv->large.block_w = block_w;
|
||||
pixmap_priv->large.block_h = block_h;
|
||||
pixmap_priv->block_w = block_w;
|
||||
pixmap_priv->block_h = block_h;
|
||||
return _glamor_create_fbo_array(glamor_priv, w, h, format, flag,
|
||||
block_w, block_h, pixmap_priv, 0);
|
||||
}
|
||||
|
@ -482,11 +451,11 @@ glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv)
|
|||
if (pixmap_priv == NULL)
|
||||
return NULL;
|
||||
|
||||
fbo = pixmap_priv->base.fbo;
|
||||
fbo = pixmap_priv->fbo;
|
||||
if (fbo == NULL)
|
||||
return NULL;
|
||||
|
||||
pixmap_priv->base.fbo = NULL;
|
||||
pixmap_priv->fbo = NULL;
|
||||
return fbo;
|
||||
}
|
||||
|
||||
|
@ -498,47 +467,44 @@ glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo)
|
|||
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
if (pixmap_priv->base.fbo)
|
||||
if (pixmap_priv->fbo)
|
||||
return;
|
||||
|
||||
pixmap_priv->base.fbo = fbo;
|
||||
pixmap_priv->fbo = fbo;
|
||||
|
||||
switch (pixmap_priv->type) {
|
||||
case GLAMOR_TEXTURE_LARGE:
|
||||
case GLAMOR_TEXTURE_ONLY:
|
||||
case GLAMOR_TEXTURE_DRM:
|
||||
pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL;
|
||||
pixmap_priv->gl_fbo = GLAMOR_FBO_NORMAL;
|
||||
if (fbo->tex != 0)
|
||||
pixmap_priv->base.gl_tex = 1;
|
||||
pixmap_priv->gl_tex = 1;
|
||||
else {
|
||||
/* XXX For the Xephyr only, may be broken now. */
|
||||
pixmap_priv->base.gl_tex = 0;
|
||||
pixmap_priv->gl_tex = 0;
|
||||
}
|
||||
case GLAMOR_MEMORY_MAP:
|
||||
pixmap->devPrivate.ptr = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv)
|
||||
glamor_pixmap_destroy_fbo(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_private *priv)
|
||||
{
|
||||
glamor_pixmap_fbo *fbo;
|
||||
|
||||
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
if (glamor_pixmap_priv_is_large(priv)) {
|
||||
int i;
|
||||
glamor_pixmap_private_large_t *large = &priv->large;
|
||||
|
||||
for (i = 0; i < large->block_wcnt * large->block_hcnt; i++)
|
||||
glamor_destroy_fbo(large->fbo_array[i]);
|
||||
free(large->fbo_array);
|
||||
for (i = 0; i < priv->block_wcnt * priv->block_hcnt; i++)
|
||||
glamor_destroy_fbo(glamor_priv, priv->fbo_array[i]);
|
||||
free(priv->fbo_array);
|
||||
}
|
||||
else {
|
||||
fbo = glamor_pixmap_detach_fbo(priv);
|
||||
if (fbo)
|
||||
glamor_destroy_fbo(fbo);
|
||||
glamor_destroy_fbo(glamor_priv, fbo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -551,7 +517,7 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
|
|||
|
||||
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
if (pixmap_priv->base.fbo == NULL) {
|
||||
if (pixmap_priv->fbo == NULL) {
|
||||
|
||||
fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width,
|
||||
pixmap->drawable.height, format, flag);
|
||||
|
@ -562,13 +528,13 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
|
|||
}
|
||||
else {
|
||||
/* We do have a fbo, but it may lack of fb or tex. */
|
||||
if (!pixmap_priv->base.fbo->tex)
|
||||
pixmap_priv->base.fbo->tex =
|
||||
if (!pixmap_priv->fbo->tex)
|
||||
pixmap_priv->fbo->tex =
|
||||
_glamor_create_tex(glamor_priv, pixmap->drawable.width,
|
||||
pixmap->drawable.height, format);
|
||||
|
||||
if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->base.fbo->fb == 0)
|
||||
if (glamor_pixmap_ensure_fb(pixmap_priv->base.fbo) != 0)
|
||||
if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->fbo->fb == 0)
|
||||
if (glamor_pixmap_ensure_fb(glamor_priv, pixmap_priv->fbo) != 0)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -583,7 +549,7 @@ glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back)
|
|||
|
||||
front_priv = glamor_get_pixmap_private(front);
|
||||
back_priv = glamor_get_pixmap_private(back);
|
||||
temp_fbo = front_priv->base.fbo;
|
||||
front_priv->base.fbo = back_priv->base.fbo;
|
||||
back_priv->base.fbo = temp_fbo;
|
||||
temp_fbo = front_priv->fbo;
|
||||
front_priv->fbo = back_priv->fbo;
|
||||
back_priv->fbo = temp_fbo;
|
||||
}
|
||||
|
|
|
@ -97,7 +97,6 @@ glamor_font_get(ScreenPtr screen, FontPtr font)
|
|||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, glamor_font->texture_id);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
|
|||
&glamor_priv->poly_glyph_blt_progs,
|
||||
&glamor_facet_poly_glyph_blt);
|
||||
if (!prog)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
|
@ -138,12 +138,9 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
|
|||
}
|
||||
}
|
||||
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
return TRUE;
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -160,32 +157,6 @@ glamor_poly_glyph_blt(DrawablePtr drawable, GCPtr gc,
|
|||
ppci, pglyph_base);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_poly_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int start_x, int y, unsigned int nglyph,
|
||||
CharInfoPtr *ppci, void *pglyph_base)
|
||||
{
|
||||
if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci,
|
||||
pglyph_base))
|
||||
return TRUE;
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) &&
|
||||
glamor_ddx_fallback_check_gc(gc)) {
|
||||
return FALSE;
|
||||
}
|
||||
miPolyGlyphBlt(drawable, gc, start_x, y, nglyph,
|
||||
ppci, pglyph_base);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_image_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int start_x, int y, unsigned int nglyph,
|
||||
CharInfoPtr *ppci, void *pglyph_base)
|
||||
{
|
||||
miImageGlyphBlt(drawable, gc, start_x, y, nglyph, ppci, pglyph_base);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
|
||||
DrawablePtr drawable, int w, int h, int x, int y)
|
||||
|
@ -217,7 +188,7 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
|
|||
&glamor_priv->poly_glyph_blt_progs,
|
||||
&glamor_facet_poly_glyph_blt);
|
||||
if (!prog)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
|
@ -256,12 +227,9 @@ glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
|
|||
glDrawArrays(GL_POINTS, 0, num_points);
|
||||
}
|
||||
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
return TRUE;
|
||||
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -275,21 +243,3 @@ glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
|
|||
|
||||
miPushPixels(pGC, pBitmap, pDrawable, w, h, x, y);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_push_pixels_nf(GCPtr gc, PixmapPtr bitmap,
|
||||
DrawablePtr drawable, int w, int h, int x, int y)
|
||||
{
|
||||
if (glamor_push_pixels_gl(gc, bitmap, drawable, w, h, x, y))
|
||||
return TRUE;
|
||||
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) &&
|
||||
glamor_ddx_fallback_check_pixmap(&bitmap->drawable) &&
|
||||
glamor_ddx_fallback_check_gc(gc))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
miPushPixels(gc, bitmap, drawable, w, h, x, y);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1166,11 +1166,9 @@ static void
|
|||
glamor_glyphs_flush_mask(struct glyphs_flush_mask_arg *arg)
|
||||
{
|
||||
if (arg->buffer->count > 0) {
|
||||
#ifdef RENDER
|
||||
glamor_composite_glyph_rects(PictOpAdd, arg->buffer->source,
|
||||
NULL, arg->mask,
|
||||
arg->buffer->count, arg->buffer->rects);
|
||||
#endif
|
||||
}
|
||||
arg->buffer->count = 0;
|
||||
arg->buffer->source = NULL;
|
||||
|
@ -1769,15 +1767,3 @@ glamor_glyphs(CARD8 op,
|
|||
_glamor_glyphs(op, src, dst, mask_format, x_src,
|
||||
y_src, nlist, list, glyphs, TRUE);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_glyphs_nf(CARD8 op,
|
||||
PicturePtr src,
|
||||
PicturePtr dst,
|
||||
PictFormatPtr mask_format,
|
||||
INT16 x_src,
|
||||
INT16 y_src, int nlist, GlyphListPtr list, GlyphPtr *glyphs)
|
||||
{
|
||||
return _glamor_glyphs(op, src, dst, mask_format, x_src,
|
||||
y_src, nlist, list, glyphs, FALSE);
|
||||
}
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
|
||||
#include "glamor_priv.h"
|
||||
|
||||
#ifdef RENDER
|
||||
|
||||
#define LINEAR_SMALL_STOPS (6 + 2)
|
||||
#define LINEAR_LARGE_STOPS (16 + 2)
|
||||
|
||||
|
@ -684,9 +682,9 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
|
|||
return 0;
|
||||
}
|
||||
|
||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
||||
glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
|
||||
|
||||
pixmap_priv_get_dest_scale(pixmap_priv, xscale, yscale);
|
||||
pixmap_priv_get_dest_scale(pixmap, pixmap_priv, xscale, yscale);
|
||||
|
||||
DEBUGF("xscale = %f, yscale = %f,"
|
||||
" x_source = %d, y_source = %d, width = %d, height = %d\n",
|
||||
|
@ -995,6 +993,8 @@ glamor_generate_radial_gradient_picture(ScreenPtr screen,
|
|||
vertices, tex_vertices, 0))
|
||||
goto GRADIENT_FAIL;
|
||||
|
||||
glamor_set_alu(screen, GXcopy);
|
||||
|
||||
/* Set all the stops and colors to shader. */
|
||||
if (stops_count > RADIAL_SMALL_STOPS) {
|
||||
stop_colors = malloc(4 * stops_count * sizeof(float));
|
||||
|
@ -1311,6 +1311,8 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
|
|||
vertices, tex_vertices, 1))
|
||||
goto GRADIENT_FAIL;
|
||||
|
||||
glamor_set_alu(screen, GXcopy);
|
||||
|
||||
/* Normalize the PTs. */
|
||||
glamor_set_normalize_pt(xscale, yscale,
|
||||
pixman_fixed_to_double(src_picture->pSourcePict->
|
||||
|
@ -1473,5 +1475,3 @@ glamor_generate_linear_gradient_picture(ScreenPtr screen,
|
|||
}
|
||||
|
||||
#endif /* End of GLAMOR_GRADIENT_SHADER */
|
||||
|
||||
#endif /* End of RENDER */
|
||||
|
|
|
@ -102,19 +102,6 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
|||
glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_put_image_nf(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||
int w, int h, int leftPad, int format, char *bits)
|
||||
{
|
||||
if (glamor_put_image_gl(drawable, gc, depth, x, y, w, h, leftPad, format, bits))
|
||||
return TRUE;
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) &&
|
||||
glamor_ddx_fallback_check_gc(gc))
|
||||
return FALSE;
|
||||
glamor_put_image_bail(drawable, gc, depth, x, y, w, h, leftPad, format, bits);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h,
|
||||
unsigned int format, unsigned long plane_mask, char *d)
|
||||
|
@ -163,17 +150,3 @@ glamor_get_image(DrawablePtr drawable, int x, int y, int w, int h,
|
|||
return;
|
||||
glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_get_image_nf(DrawablePtr drawable, int x, int y, int w, int h,
|
||||
unsigned int format, unsigned long plane_mask, char *d)
|
||||
{
|
||||
if (glamor_get_image_gl(drawable, x, y, w, h, format, plane_mask, d))
|
||||
return TRUE;
|
||||
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable))
|
||||
return FALSE;
|
||||
|
||||
glamor_get_image_bail(drawable, x, y, w, h, format, plane_mask, d);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
#include "glamor_priv.h"
|
||||
|
||||
static inline glamor_pixmap_private_large_t *
|
||||
static inline glamor_pixmap_private *
|
||||
__glamor_large(glamor_pixmap_private *pixmap_priv) {
|
||||
assert(pixmap_priv->type == GLAMOR_TEXTURE_LARGE);
|
||||
return &pixmap_priv->large;
|
||||
assert(glamor_pixmap_priv_is_large(pixmap_priv));
|
||||
return pixmap_priv;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,12 +150,13 @@ __glamor_compute_clipped_regions(int block_w,
|
|||
*/
|
||||
|
||||
glamor_pixmap_clipped_regions *
|
||||
glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
|
||||
glamor_compute_clipped_regions_ext(PixmapPtr pixmap,
|
||||
RegionPtr region,
|
||||
int *n_region,
|
||||
int inner_block_w, int inner_block_h,
|
||||
int reverse, int upsidedown)
|
||||
{
|
||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
glamor_pixmap_clipped_regions *clipped_regions, *inner_regions,
|
||||
*result_regions;
|
||||
int i, j, x, y, k, inner_n_regions;
|
||||
|
@ -166,7 +167,7 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
|
|||
|
||||
DEBUGF("ext called \n");
|
||||
|
||||
if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
|
||||
if (glamor_pixmap_priv_is_small(pixmap_priv)) {
|
||||
clipped_regions = calloc(1, sizeof(*clipped_regions));
|
||||
if (clipped_regions == NULL) {
|
||||
*n_region = 0;
|
||||
|
@ -176,24 +177,22 @@ glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
|
|||
clipped_regions[0].block_idx = 0;
|
||||
RegionCopy(clipped_regions[0].region, region);
|
||||
*n_region = 1;
|
||||
block_w = pixmap_priv->base.pixmap->drawable.width;
|
||||
block_h = pixmap_priv->base.pixmap->drawable.height;
|
||||
block_w = pixmap->drawable.width;
|
||||
block_h = pixmap->drawable.height;
|
||||
box_array = &small_box;
|
||||
small_box.x1 = small_box.y1 = 0;
|
||||
small_box.x2 = block_w;
|
||||
small_box.y2 = block_h;
|
||||
}
|
||||
else {
|
||||
glamor_pixmap_private_large_t *priv = __glamor_large(pixmap_priv);
|
||||
glamor_pixmap_private *priv = __glamor_large(pixmap_priv);
|
||||
|
||||
clipped_regions = __glamor_compute_clipped_regions(priv->block_w,
|
||||
priv->block_h,
|
||||
priv->block_wcnt,
|
||||
0, 0,
|
||||
priv->base.pixmap->
|
||||
drawable.width,
|
||||
priv->base.pixmap->
|
||||
drawable.height,
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height,
|
||||
region, n_region,
|
||||
reverse, upsidedown);
|
||||
|
||||
|
@ -336,7 +335,8 @@ _glamor_largepixmap_reflect_fixup(short *xy1, short *xy2, int wh)
|
|||
*
|
||||
*/
|
||||
static glamor_pixmap_clipped_regions *
|
||||
_glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
||||
_glamor_compute_clipped_regions(PixmapPtr pixmap,
|
||||
glamor_pixmap_private *pixmap_priv,
|
||||
RegionPtr region, int *n_region,
|
||||
int repeat_type, int is_transform,
|
||||
int reverse, int upsidedown)
|
||||
|
@ -352,10 +352,10 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
int right_shift = 0;
|
||||
int down_shift = 0;
|
||||
int x_center_shift = 0, y_center_shift = 0;
|
||||
glamor_pixmap_private_large_t *priv;
|
||||
glamor_pixmap_private *priv;
|
||||
|
||||
DEBUGRegionPrint(region);
|
||||
if (pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
|
||||
if (glamor_pixmap_priv_is_small(pixmap_priv)) {
|
||||
clipped_regions = calloc(1, sizeof(*clipped_regions));
|
||||
clipped_regions[0].region = RegionCreate(NULL, 1);
|
||||
clipped_regions[0].block_idx = 0;
|
||||
|
@ -366,8 +366,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
|
||||
priv = __glamor_large(pixmap_priv);
|
||||
|
||||
pixmap_width = priv->base.pixmap->drawable.width;
|
||||
pixmap_height = priv->base.pixmap->drawable.height;
|
||||
pixmap_width = pixmap->drawable.width;
|
||||
pixmap_height = pixmap->drawable.height;
|
||||
if (repeat_type == 0 || repeat_type == RepeatPad) {
|
||||
RegionPtr saved_region = NULL;
|
||||
|
||||
|
@ -385,10 +385,8 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
priv->block_h,
|
||||
priv->block_wcnt,
|
||||
0, 0,
|
||||
priv->base.pixmap->
|
||||
drawable.width,
|
||||
priv->base.pixmap->
|
||||
drawable.height,
|
||||
pixmap->drawable.width,
|
||||
pixmap->drawable.height,
|
||||
region, n_region,
|
||||
reverse, upsidedown);
|
||||
if (saved_region)
|
||||
|
@ -670,11 +668,13 @@ _glamor_compute_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
}
|
||||
|
||||
glamor_pixmap_clipped_regions *
|
||||
glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region,
|
||||
glamor_compute_clipped_regions(PixmapPtr pixmap,
|
||||
RegionPtr region,
|
||||
int *n_region, int repeat_type,
|
||||
int reverse, int upsidedown)
|
||||
{
|
||||
return _glamor_compute_clipped_regions(priv, region, n_region, repeat_type,
|
||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||
return _glamor_compute_clipped_regions(pixmap, priv, region, n_region, repeat_type,
|
||||
0, reverse, upsidedown);
|
||||
}
|
||||
|
||||
|
@ -682,12 +682,13 @@ glamor_compute_clipped_regions(glamor_pixmap_private *priv, RegionPtr region,
|
|||
* by default. Or just use region32 for repeat cases?
|
||||
**/
|
||||
glamor_pixmap_clipped_regions *
|
||||
glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
||||
glamor_compute_transform_clipped_regions(PixmapPtr pixmap,
|
||||
struct pixman_transform *transform,
|
||||
RegionPtr region, int *n_region,
|
||||
int dx, int dy, int repeat_type,
|
||||
int reverse, int upsidedown)
|
||||
{
|
||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||
BoxPtr temp_extent;
|
||||
struct pixman_box32 temp_box;
|
||||
struct pixman_box16 short_box;
|
||||
|
@ -714,8 +715,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
|||
temp_box.x1 = 0;
|
||||
if (temp_box.y1 < 0)
|
||||
temp_box.y1 = 0;
|
||||
temp_box.x2 = MIN(temp_box.x2, priv->base.pixmap->drawable.width);
|
||||
temp_box.y2 = MIN(temp_box.y2, priv->base.pixmap->drawable.height);
|
||||
temp_box.x2 = MIN(temp_box.x2, pixmap->drawable.width);
|
||||
temp_box.y2 = MIN(temp_box.y2, pixmap->drawable.height);
|
||||
}
|
||||
/* Now copy back the box32 to a box16 box. */
|
||||
short_box.x1 = temp_box.x1;
|
||||
|
@ -725,7 +726,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
|||
RegionInitBoxes(temp_region, &short_box, 1);
|
||||
DEBUGF("copy to temp source region \n");
|
||||
DEBUGRegionPrint(temp_region);
|
||||
ret = _glamor_compute_clipped_regions(priv,
|
||||
ret = _glamor_compute_clipped_regions(pixmap,
|
||||
priv,
|
||||
temp_region,
|
||||
n_region,
|
||||
repeat_type, 1, reverse, upsidedown);
|
||||
|
@ -747,7 +749,8 @@ glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
|||
* if the clipped result cross the region boundary.
|
||||
*/
|
||||
static void
|
||||
glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
||||
glamor_merge_clipped_regions(PixmapPtr pixmap,
|
||||
glamor_pixmap_private *pixmap_priv,
|
||||
int repeat_type,
|
||||
glamor_pixmap_clipped_regions *clipped_regions,
|
||||
int *n_regions, int *need_clean_fbo)
|
||||
|
@ -760,11 +763,11 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
int overlap;
|
||||
int i;
|
||||
int pixmap_width, pixmap_height;
|
||||
glamor_pixmap_private_large_t *priv;
|
||||
glamor_pixmap_private *priv;
|
||||
|
||||
priv = __glamor_large(pixmap_priv);
|
||||
pixmap_width = priv->base.pixmap->drawable.width;
|
||||
pixmap_height = priv->base.pixmap->drawable.height;
|
||||
pixmap_width = pixmap->drawable.width;
|
||||
pixmap_height =pixmap->drawable.height;
|
||||
|
||||
temp_region = RegionCreate(NULL, 4);
|
||||
for (i = 0; i < *n_regions; i++) {
|
||||
|
@ -784,10 +787,10 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
DEBUGF("%d %d %d %d \n", temp_box.x1, temp_box.y1, temp_box.x2,
|
||||
temp_box.y2);
|
||||
temp_pixmap =
|
||||
glamor_create_pixmap(priv->base.pixmap->drawable.pScreen,
|
||||
glamor_create_pixmap(pixmap->drawable.pScreen,
|
||||
temp_box.x2 - temp_box.x1,
|
||||
temp_box.y2 - temp_box.y1,
|
||||
priv->base.pixmap->drawable.depth,
|
||||
pixmap->drawable.depth,
|
||||
GLAMOR_CREATE_PIXMAP_FIXUP);
|
||||
if (temp_pixmap == NULL) {
|
||||
assert(0);
|
||||
|
@ -795,7 +798,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
}
|
||||
|
||||
temp_priv = glamor_get_pixmap_private(temp_pixmap);
|
||||
assert(temp_priv->type != GLAMOR_TEXTURE_LARGE);
|
||||
assert(glamor_pixmap_priv_is_small(temp_priv));
|
||||
|
||||
priv->box = temp_box;
|
||||
if (temp_extent->x1 >= 0 && temp_extent->x2 <= pixmap_width
|
||||
|
@ -808,7 +811,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
copy_box.y2 = temp_extent->y2 - temp_extent->y1;
|
||||
dx = temp_extent->x1;
|
||||
dy = temp_extent->y1;
|
||||
glamor_copy(&priv->base.pixmap->drawable,
|
||||
glamor_copy(&pixmap->drawable,
|
||||
&temp_pixmap->drawable,
|
||||
NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL);
|
||||
// glamor_solid(temp_pixmap, 0, 0, temp_pixmap->drawable.width,
|
||||
|
@ -840,7 +843,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
copy_box.x1, copy_box.y1, copy_box.x2,
|
||||
copy_box.y2, dx, dy);
|
||||
|
||||
glamor_copy(&priv->base.pixmap->drawable,
|
||||
glamor_copy(&pixmap->drawable,
|
||||
&temp_pixmap->drawable,
|
||||
NULL, ©_box, 1, dx, dy, 0, 0, 0, NULL);
|
||||
|
||||
|
@ -855,7 +858,7 @@ glamor_merge_clipped_regions(glamor_pixmap_private *pixmap_priv,
|
|||
RegionDestroy(clipped_regions[i].region);
|
||||
RegionDestroy(temp_region);
|
||||
priv->box = temp_box;
|
||||
priv->base.fbo = glamor_pixmap_detach_fbo(temp_priv);
|
||||
priv->fbo = glamor_pixmap_detach_fbo(temp_priv);
|
||||
DEBUGF("priv box x1 %d y1 %d x2 %d y2 %d \n",
|
||||
priv->box.x1, priv->box.y1, priv->box.x2, priv->box.y2);
|
||||
glamor_destroy_pixmap(temp_pixmap);
|
||||
|
@ -920,10 +923,10 @@ glamor_get_transform_block_size(struct pixman_transform *transform,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#define VECTOR_FROM_POINT(p, x, y) \
|
||||
#define VECTOR_FROM_POINT(p, x, y) do {\
|
||||
p.v[0] = x; \
|
||||
p.v[1] = y; \
|
||||
p.v[2] = 1.0;
|
||||
p.v[2] = 1.0; } while (0)
|
||||
void
|
||||
glamor_get_transform_extent_from_box(struct pixman_box32 *box,
|
||||
struct pixman_transform *transform)
|
||||
|
@ -933,10 +936,10 @@ glamor_get_transform_extent_from_box(struct pixman_box32 *box,
|
|||
|
||||
struct pixman_f_transform ftransform;
|
||||
|
||||
VECTOR_FROM_POINT(p0, box->x1, box->y1)
|
||||
VECTOR_FROM_POINT(p1, box->x2, box->y1)
|
||||
VECTOR_FROM_POINT(p2, box->x2, box->y2)
|
||||
VECTOR_FROM_POINT(p3, box->x1, box->y2)
|
||||
VECTOR_FROM_POINT(p0, box->x1, box->y1);
|
||||
VECTOR_FROM_POINT(p1, box->x2, box->y1);
|
||||
VECTOR_FROM_POINT(p2, box->x2, box->y2);
|
||||
VECTOR_FROM_POINT(p3, box->x1, box->y2);
|
||||
|
||||
pixman_f_transform_from_pixman_transform(&ftransform, transform);
|
||||
pixman_f_transform_point(&ftransform, &p0);
|
||||
|
@ -966,7 +969,8 @@ glamor_get_transform_extent_from_box(struct pixman_box32 *box,
|
|||
}
|
||||
|
||||
static void
|
||||
_glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
|
||||
_glamor_process_transformed_clipped_region(PixmapPtr pixmap,
|
||||
glamor_pixmap_private *priv,
|
||||
int repeat_type,
|
||||
glamor_pixmap_clipped_regions *
|
||||
clipped_regions, int *n_regions,
|
||||
|
@ -976,7 +980,7 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
|
|||
|
||||
if (*n_regions != 1) {
|
||||
/* Merge all source regions into one region. */
|
||||
glamor_merge_clipped_regions(priv, repeat_type,
|
||||
glamor_merge_clipped_regions(pixmap, priv, repeat_type,
|
||||
clipped_regions, n_regions,
|
||||
need_clean_fbo);
|
||||
}
|
||||
|
@ -990,22 +994,22 @@ _glamor_process_transformed_clipped_region(glamor_pixmap_private *priv,
|
|||
int rem;
|
||||
|
||||
temp_box = RegionExtents(clipped_regions[0].region);
|
||||
modulus(temp_box->x1, priv->base.pixmap->drawable.width, rem);
|
||||
shift_x = (temp_box->x1 - rem) / priv->base.pixmap->drawable.width;
|
||||
modulus(temp_box->y1, priv->base.pixmap->drawable.height, rem);
|
||||
shift_y = (temp_box->y1 - rem) / priv->base.pixmap->drawable.height;
|
||||
modulus(temp_box->x1, pixmap->drawable.width, rem);
|
||||
shift_x = (temp_box->x1 - rem) / pixmap->drawable.width;
|
||||
modulus(temp_box->y1, pixmap->drawable.height, rem);
|
||||
shift_y = (temp_box->y1 - rem) / pixmap->drawable.height;
|
||||
|
||||
if (shift_x != 0) {
|
||||
__glamor_large(priv)->box.x1 +=
|
||||
shift_x * priv->base.pixmap->drawable.width;
|
||||
shift_x * pixmap->drawable.width;
|
||||
__glamor_large(priv)->box.x2 +=
|
||||
shift_x * priv->base.pixmap->drawable.width;
|
||||
shift_x * pixmap->drawable.width;
|
||||
}
|
||||
if (shift_y != 0) {
|
||||
__glamor_large(priv)->box.y1 +=
|
||||
shift_y * priv->base.pixmap->drawable.height;
|
||||
shift_y * pixmap->drawable.height;
|
||||
__glamor_large(priv)->box.y2 +=
|
||||
shift_y * priv->base.pixmap->drawable.height;
|
||||
shift_y * pixmap->drawable.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1016,9 +1020,9 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
glamor_pixmap_private *source_pixmap_priv,
|
||||
glamor_pixmap_private *mask_pixmap_priv,
|
||||
glamor_pixmap_private *dest_pixmap_priv,
|
||||
PixmapPtr source_pixmap,
|
||||
PixmapPtr mask_pixmap,
|
||||
PixmapPtr dest_pixmap,
|
||||
RegionPtr region, Bool force_clip,
|
||||
INT16 x_source,
|
||||
INT16 y_source,
|
||||
|
@ -1027,6 +1031,11 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
INT16 x_dest, INT16 y_dest,
|
||||
CARD16 width, CARD16 height)
|
||||
{
|
||||
ScreenPtr screen = dest_pixmap->drawable.pScreen;
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
|
||||
glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
|
||||
glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||
glamor_pixmap_clipped_regions *clipped_dest_regions;
|
||||
glamor_pixmap_clipped_regions *clipped_source_regions;
|
||||
glamor_pixmap_clipped_regions *clipped_mask_regions;
|
||||
|
@ -1056,12 +1065,12 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
else
|
||||
mask_repeat_type = RepeatNone;
|
||||
|
||||
if (dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
if (glamor_pixmap_priv_is_large(dest_pixmap_priv)) {
|
||||
dest_block_width = __glamor_large(dest_pixmap_priv)->block_w;
|
||||
dest_block_height = __glamor_large(dest_pixmap_priv)->block_h;
|
||||
} else {
|
||||
dest_block_width = dest_pixmap_priv->base.pixmap->drawable.width;
|
||||
dest_block_height = dest_pixmap_priv->base.pixmap->drawable.height;
|
||||
dest_block_width = dest_pixmap->drawable.width;
|
||||
dest_block_height = dest_pixmap->drawable.height;
|
||||
}
|
||||
fixed_block_width = dest_block_width;
|
||||
fixed_block_height = dest_block_height;
|
||||
|
@ -1087,7 +1096,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
*/
|
||||
if (source_pixmap_priv
|
||||
&& source->transform
|
||||
&& source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
&& glamor_pixmap_priv_is_large(source_pixmap_priv)) {
|
||||
int source_transformed_block_width, source_transformed_block_height;
|
||||
|
||||
if (!glamor_get_transform_block_size(source->transform,
|
||||
|
@ -1109,7 +1118,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
}
|
||||
|
||||
if (mask_pixmap_priv
|
||||
&& mask->transform && mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
&& mask->transform && glamor_pixmap_priv_is_large(mask_pixmap_priv)) {
|
||||
int mask_transformed_block_width, mask_transformed_block_height;
|
||||
|
||||
if (!glamor_get_transform_block_size(mask->transform,
|
||||
|
@ -1134,12 +1143,12 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
if (force_clip || fixed_block_width < dest_block_width
|
||||
|| fixed_block_height < dest_block_height)
|
||||
clipped_dest_regions =
|
||||
glamor_compute_clipped_regions_ext(dest_pixmap_priv, region,
|
||||
glamor_compute_clipped_regions_ext(dest_pixmap, region,
|
||||
&n_dest_regions,
|
||||
fixed_block_width,
|
||||
fixed_block_height, 0, 0);
|
||||
else
|
||||
clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap_priv,
|
||||
clipped_dest_regions = glamor_compute_clipped_regions(dest_pixmap,
|
||||
region,
|
||||
&n_dest_regions,
|
||||
0, 0, 0);
|
||||
|
@ -1147,7 +1156,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
if (source_pixmap_priv
|
||||
&& (source_pixmap_priv == dest_pixmap_priv ||
|
||||
source_pixmap_priv == mask_pixmap_priv)
|
||||
&& source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
&& glamor_pixmap_priv_is_large(source_pixmap_priv)) {
|
||||
/* XXX self-copy... */
|
||||
need_free_source_pixmap_priv = source_pixmap_priv;
|
||||
source_pixmap_priv = malloc(sizeof(*source_pixmap_priv));
|
||||
|
@ -1163,12 +1172,12 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
glamor_set_pixmap_fbo_current(dest_pixmap_priv,
|
||||
clipped_dest_regions[i].block_idx);
|
||||
if (source_pixmap_priv &&
|
||||
source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
glamor_pixmap_priv_is_large(source_pixmap_priv)) {
|
||||
if (!source->transform && source_repeat_type != RepeatPad) {
|
||||
RegionTranslate(clipped_dest_regions[i].region,
|
||||
x_source - x_dest, y_source - y_dest);
|
||||
clipped_source_regions =
|
||||
glamor_compute_clipped_regions(source_pixmap_priv,
|
||||
glamor_compute_clipped_regions(source_pixmap,
|
||||
clipped_dest_regions[i].
|
||||
region, &n_source_regions,
|
||||
source_repeat_type, 0, 0);
|
||||
|
@ -1176,7 +1185,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
}
|
||||
else {
|
||||
clipped_source_regions =
|
||||
glamor_compute_transform_clipped_regions(source_pixmap_priv,
|
||||
glamor_compute_transform_clipped_regions(source_pixmap,
|
||||
source->transform,
|
||||
clipped_dest_regions
|
||||
[i].region,
|
||||
|
@ -1193,7 +1202,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
}
|
||||
else
|
||||
_glamor_process_transformed_clipped_region
|
||||
(source_pixmap_priv, source_repeat_type,
|
||||
(source_pixmap, source_pixmap_priv, source_repeat_type,
|
||||
clipped_source_regions, &n_source_regions,
|
||||
&need_clean_source_fbo);
|
||||
}
|
||||
|
@ -1204,7 +1213,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
clipped_source_regions[j].block_idx);
|
||||
|
||||
if (mask_pixmap_priv &&
|
||||
mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
glamor_pixmap_priv_is_large(mask_pixmap_priv)) {
|
||||
if (is_normal_mask_fbo && is_normal_source_fbo) {
|
||||
/* both mask and source are normal fbo box without transform or repeatpad.
|
||||
* The region is clipped against source and then we clip it against mask here.*/
|
||||
|
@ -1214,7 +1223,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
RegionTranslate(clipped_source_regions[j].region,
|
||||
-x_source + x_mask, -y_source + y_mask);
|
||||
clipped_mask_regions =
|
||||
glamor_compute_clipped_regions(mask_pixmap_priv,
|
||||
glamor_compute_clipped_regions(mask_pixmap,
|
||||
clipped_source_regions
|
||||
[j].region,
|
||||
&n_mask_regions,
|
||||
|
@ -1230,7 +1239,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
RegionTranslate(clipped_dest_regions[i].region,
|
||||
-x_dest + x_mask, -y_dest + y_mask);
|
||||
clipped_mask_regions =
|
||||
glamor_compute_clipped_regions(mask_pixmap_priv,
|
||||
glamor_compute_clipped_regions(mask_pixmap,
|
||||
clipped_dest_regions
|
||||
[i].region,
|
||||
&n_mask_regions,
|
||||
|
@ -1244,14 +1253,14 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
if (!is_normal_source_fbo)
|
||||
clipped_mask_regions =
|
||||
glamor_compute_transform_clipped_regions
|
||||
(mask_pixmap_priv, mask->transform,
|
||||
(mask_pixmap, mask->transform,
|
||||
clipped_dest_regions[i].region,
|
||||
&n_mask_regions, x_mask - x_dest,
|
||||
y_mask - y_dest, mask_repeat_type, 0, 0);
|
||||
else
|
||||
clipped_mask_regions =
|
||||
glamor_compute_transform_clipped_regions
|
||||
(mask_pixmap_priv, mask->transform,
|
||||
(mask_pixmap, mask->transform,
|
||||
clipped_source_regions[j].region,
|
||||
&n_mask_regions, x_mask - x_source,
|
||||
y_mask - y_source, mask_repeat_type, 0, 0);
|
||||
|
@ -1263,7 +1272,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
}
|
||||
else
|
||||
_glamor_process_transformed_clipped_region
|
||||
(mask_pixmap_priv, mask_repeat_type,
|
||||
(mask_pixmap, mask_pixmap_priv, mask_repeat_type,
|
||||
clipped_mask_regions, &n_mask_regions,
|
||||
&need_clean_mask_fbo);
|
||||
}
|
||||
|
@ -1273,9 +1282,9 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
if (!glamor_composite_clipped_region(op, \
|
||||
null_source ? NULL : source, \
|
||||
null_mask ? NULL : mask, dest, \
|
||||
null_source ? NULL : source_pixmap_priv, \
|
||||
null_mask ? NULL : mask_pixmap_priv, \
|
||||
dest_pixmap_priv, region, \
|
||||
null_source ? NULL : source_pixmap, \
|
||||
null_mask ? NULL : mask_pixmap, \
|
||||
dest_pixmap, region, \
|
||||
x_source, y_source, x_mask, y_mask, \
|
||||
x_dest, y_dest)) { \
|
||||
assert(0); \
|
||||
|
@ -1326,8 +1335,8 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
null_mask = 0;
|
||||
if (need_clean_mask_fbo) {
|
||||
assert(is_normal_mask_fbo == 0);
|
||||
glamor_destroy_fbo(mask_pixmap_priv->base.fbo);
|
||||
mask_pixmap_priv->base.fbo = NULL;
|
||||
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo);
|
||||
mask_pixmap_priv->fbo = NULL;
|
||||
need_clean_mask_fbo = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1355,19 +1364,19 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
null_source = 0;
|
||||
if (need_clean_source_fbo) {
|
||||
assert(is_normal_source_fbo == 0);
|
||||
glamor_destroy_fbo(source_pixmap_priv->base.fbo);
|
||||
source_pixmap_priv->base.fbo = NULL;
|
||||
glamor_destroy_fbo(glamor_priv, source_pixmap_priv->fbo);
|
||||
source_pixmap_priv->fbo = NULL;
|
||||
need_clean_source_fbo = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (mask_pixmap_priv &&
|
||||
mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
glamor_pixmap_priv_is_large(mask_pixmap_priv)) {
|
||||
if (!mask->transform && mask_repeat_type != RepeatPad) {
|
||||
RegionTranslate(clipped_dest_regions[i].region,
|
||||
x_mask - x_dest, y_mask - y_dest);
|
||||
clipped_mask_regions =
|
||||
glamor_compute_clipped_regions(mask_pixmap_priv,
|
||||
glamor_compute_clipped_regions(mask_pixmap,
|
||||
clipped_dest_regions[i].
|
||||
region, &n_mask_regions,
|
||||
mask_repeat_type, 0, 0);
|
||||
|
@ -1376,7 +1385,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
else {
|
||||
clipped_mask_regions =
|
||||
glamor_compute_transform_clipped_regions
|
||||
(mask_pixmap_priv, mask->transform,
|
||||
(mask_pixmap, mask->transform,
|
||||
clipped_dest_regions[i].region, &n_mask_regions,
|
||||
x_mask - x_dest, y_mask - y_dest, mask_repeat_type, 0,
|
||||
0);
|
||||
|
@ -1388,7 +1397,7 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
}
|
||||
else
|
||||
_glamor_process_transformed_clipped_region
|
||||
(mask_pixmap_priv, mask_repeat_type,
|
||||
(mask_pixmap, mask_pixmap_priv, mask_repeat_type,
|
||||
clipped_mask_regions, &n_mask_regions,
|
||||
&need_clean_mask_fbo);
|
||||
}
|
||||
|
@ -1417,8 +1426,8 @@ glamor_composite_largepixmap_region(CARD8 op,
|
|||
if (null_mask)
|
||||
null_mask = 0;
|
||||
if (need_clean_mask_fbo) {
|
||||
glamor_destroy_fbo(mask_pixmap_priv->base.fbo);
|
||||
mask_pixmap_priv->base.fbo = NULL;
|
||||
glamor_destroy_fbo(glamor_priv, mask_pixmap_priv->fbo);
|
||||
mask_pixmap_priv->fbo = NULL;
|
||||
need_clean_mask_fbo = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
|
|||
&glamor_facet_poly_lines);
|
||||
|
||||
if (!prog)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
/* Set up the vertex buffers for the points */
|
||||
|
||||
|
@ -117,12 +117,9 @@ glamor_poly_lines_solid_gl(DrawablePtr drawable, GCPtr gc,
|
|||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
return TRUE;
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -167,21 +164,3 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc,
|
|||
return;
|
||||
glamor_poly_lines_bail(drawable, gc, mode, n, points);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_poly_lines_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int mode, int n, DDXPointPtr points)
|
||||
{
|
||||
if (glamor_poly_lines_gl(drawable, gc, mode, n, points))
|
||||
return TRUE;
|
||||
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) &&
|
||||
glamor_ddx_fallback_check_gc(gc))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
glamor_poly_lines_bail(drawable, gc, mode, n, points);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,19 +69,9 @@ glamor_create_picture(PicturePtr picture)
|
|||
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
}
|
||||
else {
|
||||
if (GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv)) {
|
||||
/* If the picture format is not compatible with glamor fbo format,
|
||||
* we have to mark this pixmap as a separated texture, and don't
|
||||
* fallback to DDX layer. */
|
||||
if (pixmap_priv->type == GLAMOR_TEXTURE_DRM
|
||||
&& !glamor_pict_format_is_compatible(picture))
|
||||
glamor_set_pixmap_type(pixmap, GLAMOR_SEPARATE_TEXTURE);
|
||||
}
|
||||
}
|
||||
|
||||
pixmap_priv->base.is_picture = 1;
|
||||
pixmap_priv->base.picture = picture;
|
||||
pixmap_priv->is_picture = 1;
|
||||
pixmap_priv->picture = picture;
|
||||
|
||||
return miCreatePicture(picture);
|
||||
}
|
||||
|
@ -99,8 +89,8 @@ glamor_destroy_picture(PicturePtr picture)
|
|||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
if (pixmap_priv) {
|
||||
pixmap_priv->base.is_picture = 0;
|
||||
pixmap_priv->base.picture = NULL;
|
||||
pixmap_priv->is_picture = 0;
|
||||
pixmap_priv->picture = NULL;
|
||||
}
|
||||
miDestroyPicture(picture);
|
||||
}
|
||||
|
@ -109,5 +99,5 @@ void
|
|||
glamor_picture_format_fixup(PicturePtr picture,
|
||||
glamor_pixmap_private *pixmap_priv)
|
||||
{
|
||||
pixmap_priv->base.picture = picture;
|
||||
pixmap_priv->picture = picture;
|
||||
}
|
||||
|
|
|
@ -63,31 +63,36 @@ glamor_pixmap_fini(ScreenPtr screen)
|
|||
}
|
||||
|
||||
void
|
||||
glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *fbo, int x0, int y0,
|
||||
glamor_set_destination_pixmap_fbo(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_fbo *fbo, int x0, int y0,
|
||||
int width, int height)
|
||||
{
|
||||
glamor_make_current(fbo->glamor_priv);
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
|
||||
glViewport(x0, y0, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv)
|
||||
glamor_set_destination_pixmap_priv_nc(glamor_screen_private *glamor_priv,
|
||||
PixmapPtr pixmap,
|
||||
glamor_pixmap_private *pixmap_priv)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap_priv, w, h);
|
||||
glamor_set_destination_pixmap_fbo(pixmap_priv->base.fbo, 0, 0, w, h);
|
||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, pixmap_priv, w, h);
|
||||
glamor_set_destination_pixmap_fbo(glamor_priv, pixmap_priv->fbo, 0, 0, w, h);
|
||||
}
|
||||
|
||||
int
|
||||
glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv)
|
||||
glamor_set_destination_pixmap_priv(glamor_screen_private *glamor_priv,
|
||||
PixmapPtr pixmap,
|
||||
glamor_pixmap_private *pixmap_priv)
|
||||
{
|
||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
|
||||
return -1;
|
||||
|
||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
||||
glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -96,8 +101,10 @@ glamor_set_destination_pixmap(PixmapPtr pixmap)
|
|||
{
|
||||
int err;
|
||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
|
||||
err = glamor_set_destination_pixmap_priv(pixmap_priv);
|
||||
err = glamor_set_destination_pixmap_priv(glamor_priv, pixmap, pixmap_priv);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -471,7 +478,7 @@ glamor_get_tex_format_type_from_pixmap(PixmapPtr pixmap,
|
|||
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
|
||||
pict_format = pixmap_priv->base.picture->format;
|
||||
pict_format = pixmap_priv->picture->format;
|
||||
else
|
||||
pict_format = format_for_depth(pixmap->drawable.depth);
|
||||
|
||||
|
@ -717,7 +724,6 @@ __glamor_upload_pixmap_to_texture(PixmapPtr pixmap, unsigned int *tex,
|
|||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, *tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
|
@ -742,6 +748,7 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
|||
int swap_rb, int x, int y, int w, int h,
|
||||
int stride, void *bits, int pbo)
|
||||
{
|
||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
glamor_screen_private *glamor_priv =
|
||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||
|
@ -793,25 +800,25 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
|||
if (no_alpha == 0
|
||||
&& revert == REVERT_NONE && swap_rb == SWAP_NONE_UPLOADING
|
||||
#ifdef WALKAROUND_LARGE_TEXTURE_MAP
|
||||
&& pixmap_priv->type != GLAMOR_TEXTURE_LARGE
|
||||
&& glamor_pixmap_priv_is_small(pixmap_priv)
|
||||
#endif
|
||||
) {
|
||||
int fbo_x_off, fbo_y_off;
|
||||
|
||||
assert(pixmap_priv->base.fbo->tex);
|
||||
assert(pixmap_priv->fbo->tex);
|
||||
pixmap_priv_get_fbo_off(pixmap_priv, &fbo_x_off, &fbo_y_off);
|
||||
|
||||
assert(x + fbo_x_off >= 0 && y + fbo_y_off >= 0);
|
||||
assert(x + fbo_x_off + w <= pixmap_priv->base.fbo->width);
|
||||
assert(y + fbo_y_off + h <= pixmap_priv->base.fbo->height);
|
||||
__glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->base.fbo->tex,
|
||||
assert(x + fbo_x_off + w <= pixmap_priv->fbo->width);
|
||||
assert(y + fbo_y_off + h <= pixmap_priv->fbo->height);
|
||||
__glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->fbo->tex,
|
||||
format, type,
|
||||
x + fbo_x_off, y + fbo_y_off, w, h,
|
||||
bits, pbo);
|
||||
} else {
|
||||
ptexcoords = texcoords_inv;
|
||||
|
||||
pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
|
||||
pixmap_priv_get_dest_scale(pixmap, pixmap_priv, &dst_xscale, &dst_yscale);
|
||||
glamor_set_normalize_vcoords(pixmap_priv, dst_xscale,
|
||||
dst_yscale,
|
||||
x, y,
|
||||
|
@ -826,7 +833,8 @@ _glamor_upload_bits_to_pixmap_texture(PixmapPtr pixmap, GLenum format,
|
|||
GL_FALSE, 2 * sizeof(float), ptexcoords);
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
|
||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
||||
glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
|
||||
glamor_set_alu(screen, GXcopy);
|
||||
__glamor_upload_pixmap_to_texture(pixmap, &tex,
|
||||
format, type, 0, 0, w, h, bits, pbo);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
@ -868,17 +876,17 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
|
|||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||
|
||||
if (pixmap_priv->base.gl_fbo != GLAMOR_FBO_UNATTACHED)
|
||||
if (pixmap_priv->gl_fbo != GLAMOR_FBO_UNATTACHED)
|
||||
return 0;
|
||||
|
||||
if (pixmap_priv->base.fbo
|
||||
&& (pixmap_priv->base.fbo->width < pixmap->drawable.width
|
||||
|| pixmap_priv->base.fbo->height < pixmap->drawable.height)) {
|
||||
if (pixmap_priv->fbo
|
||||
&& (pixmap_priv->fbo->width < pixmap->drawable.width
|
||||
|| pixmap_priv->fbo->height < pixmap->drawable.height)) {
|
||||
fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
||||
glamor_destroy_fbo(fbo);
|
||||
glamor_destroy_fbo(glamor_priv, fbo);
|
||||
}
|
||||
|
||||
if (pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb)
|
||||
if (pixmap_priv->fbo && pixmap_priv->fbo->fb)
|
||||
return 0;
|
||||
|
||||
if (!(no_alpha || (revert == REVERT_NORMAL)
|
||||
|
@ -889,8 +897,8 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha,
|
|||
}
|
||||
|
||||
if ((flag == GLAMOR_CREATE_FBO_NO_FBO
|
||||
&& pixmap_priv->base.fbo && pixmap_priv->base.fbo->tex)
|
||||
|| (flag == 0 && pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb))
|
||||
&& pixmap_priv->fbo && pixmap_priv->fbo->tex)
|
||||
|| (flag == 0 && pixmap_priv->fbo && pixmap_priv->fbo->fb))
|
||||
return 0;
|
||||
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
|
||||
|
@ -928,6 +936,8 @@ Bool
|
|||
glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
||||
int h, int stride, void *bits, int pbo)
|
||||
{
|
||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
GLenum format, type;
|
||||
int no_alpha, revert, swap_rb;
|
||||
glamor_pixmap_private *pixmap_priv;
|
||||
|
@ -945,10 +955,10 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
|||
return FALSE;
|
||||
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
force_clip = pixmap_priv->base.glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
|
||||
&& !glamor_check_fbo_size(pixmap_priv->base.glamor_priv, w, h);
|
||||
force_clip = glamor_priv->gl_flavor != GLAMOR_GL_DESKTOP
|
||||
&& !glamor_check_fbo_size(glamor_priv, w, h);
|
||||
|
||||
if (pixmap_priv->type == GLAMOR_TEXTURE_LARGE || force_clip) {
|
||||
if (glamor_pixmap_priv_is_large(pixmap_priv) || force_clip) {
|
||||
RegionRec region;
|
||||
BoxRec box;
|
||||
int n_region;
|
||||
|
@ -966,14 +976,14 @@ glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
|||
RegionInitBoxes(®ion, &box, 1);
|
||||
if (!force_clip)
|
||||
clipped_regions =
|
||||
glamor_compute_clipped_regions(pixmap_priv, ®ion, &n_region,
|
||||
glamor_compute_clipped_regions(pixmap, ®ion, &n_region,
|
||||
0, 0, 0);
|
||||
else
|
||||
clipped_regions =
|
||||
glamor_compute_clipped_regions_ext(pixmap_priv, ®ion,
|
||||
glamor_compute_clipped_regions_ext(pixmap, ®ion,
|
||||
&n_region,
|
||||
pixmap_priv->large.block_w,
|
||||
pixmap_priv->large.block_h,
|
||||
pixmap_priv->block_w,
|
||||
pixmap_priv->block_h,
|
||||
0,
|
||||
0);
|
||||
DEBUGF("prepare upload %dx%d to a large pixmap %p\n", w, h, pixmap);
|
||||
|
@ -1044,10 +1054,10 @@ glamor_upload_pixmap_to_texture(PixmapPtr pixmap)
|
|||
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
if ((pixmap_priv->base.fbo)
|
||||
&& (pixmap_priv->base.fbo->pbo_valid)) {
|
||||
if ((pixmap_priv->fbo)
|
||||
&& (pixmap_priv->fbo->pbo_valid)) {
|
||||
data = NULL;
|
||||
pbo = pixmap_priv->base.fbo->pbo;
|
||||
pbo = pixmap_priv->fbo->pbo;
|
||||
}
|
||||
else {
|
||||
data = pixmap->devPrivate.ptr;
|
||||
|
@ -1118,11 +1128,12 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
|
|||
glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, source_priv->base.fbo->tex);
|
||||
glBindTexture(GL_TEXTURE_2D, source_priv->fbo->tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
|
||||
glamor_set_destination_pixmap_fbo(temp_fbo, 0, 0, w, h);
|
||||
glamor_set_destination_pixmap_fbo(glamor_priv, temp_fbo, 0, 0, w, h);
|
||||
glamor_set_alu(screen, GXcopy);
|
||||
glUseProgram(glamor_priv->finish_access_prog[no_alpha]);
|
||||
glUniform1i(glamor_priv->finish_access_revert[no_alpha], revert);
|
||||
glUniform1i(glamor_priv->finish_access_swap_rb[no_alpha], swap_rb);
|
||||
|
@ -1133,62 +1144,3 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h,
|
|||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
return temp_fbo;
|
||||
}
|
||||
|
||||
/* fixup a fbo to the exact size as the pixmap. */
|
||||
/* XXX LARGE pixmap? */
|
||||
Bool
|
||||
glamor_fixup_pixmap_priv(ScreenPtr screen, glamor_pixmap_private *pixmap_priv)
|
||||
{
|
||||
glamor_pixmap_fbo *old_fbo;
|
||||
glamor_pixmap_fbo *new_fbo = NULL;
|
||||
PixmapPtr scratch = NULL;
|
||||
glamor_pixmap_private *scratch_priv;
|
||||
DrawablePtr drawable;
|
||||
GCPtr gc = NULL;
|
||||
int ret = FALSE;
|
||||
|
||||
drawable = &pixmap_priv->base.pixmap->drawable;
|
||||
|
||||
if (!GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv))
|
||||
return TRUE;
|
||||
|
||||
old_fbo = pixmap_priv->base.fbo;
|
||||
|
||||
if (!old_fbo)
|
||||
return FALSE;
|
||||
|
||||
gc = GetScratchGC(drawable->depth, screen);
|
||||
if (!gc)
|
||||
goto fail;
|
||||
|
||||
scratch = glamor_create_pixmap(screen, drawable->width, drawable->height,
|
||||
drawable->depth, GLAMOR_CREATE_PIXMAP_FIXUP);
|
||||
|
||||
scratch_priv = glamor_get_pixmap_private(scratch);
|
||||
|
||||
if (!scratch_priv->base.fbo)
|
||||
goto fail;
|
||||
|
||||
ValidateGC(&scratch->drawable, gc);
|
||||
glamor_copy_area(drawable,
|
||||
&scratch->drawable,
|
||||
gc, 0, 0, drawable->width, drawable->height, 0, 0);
|
||||
old_fbo = glamor_pixmap_detach_fbo(pixmap_priv);
|
||||
new_fbo = glamor_pixmap_detach_fbo(scratch_priv);
|
||||
glamor_pixmap_attach_fbo(pixmap_priv->base.pixmap, new_fbo);
|
||||
glamor_pixmap_attach_fbo(scratch, old_fbo);
|
||||
|
||||
DEBUGF("old %dx%d type %d\n",
|
||||
drawable->width, drawable->height, pixmap_priv->type);
|
||||
DEBUGF("copy tex %d %dx%d to tex %d %dx%d \n",
|
||||
old_fbo->tex, old_fbo->width, old_fbo->height, new_fbo->tex,
|
||||
new_fbo->width, new_fbo->height);
|
||||
ret = TRUE;
|
||||
fail:
|
||||
if (gc)
|
||||
FreeScratchGC(gc);
|
||||
if (scratch)
|
||||
glamor_destroy_pixmap(scratch);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -55,17 +55,17 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
|
|||
glamor_make_current(glamor_priv);
|
||||
|
||||
if (prog->failed)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
if (!prog->prog) {
|
||||
if (!glamor_build_program(screen, prog,
|
||||
&glamor_facet_point,
|
||||
&glamor_fill_solid))
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
}
|
||||
|
||||
if (!glamor_use_program(pixmap, gc, prog, NULL))
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
vbo_ppt = glamor_get_vbo_space(screen, npt * (2 * sizeof (INT16)), &vbo_offset);
|
||||
glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
@ -102,13 +102,10 @@ glamor_poly_point_gl(DrawablePtr drawable, GCPtr gc, int mode, int npt, DDXPoint
|
|||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
return TRUE;
|
||||
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -121,18 +118,3 @@ glamor_poly_point(DrawablePtr drawable, GCPtr gc, int mode, int npt,
|
|||
return;
|
||||
miPolyPoint(drawable, gc, mode, npt, ppt);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_poly_point_nf(DrawablePtr drawable, GCPtr gc, int mode, int npt,
|
||||
DDXPointPtr ppt)
|
||||
{
|
||||
if (glamor_poly_point_gl(drawable, gc, mode, npt, ppt))
|
||||
return TRUE;
|
||||
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
|
||||
return FALSE;
|
||||
|
||||
miPolyPoint(drawable, gc, mode, npt, ppt);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
|||
* we'll assume that it's directly mapped
|
||||
* by a lower level driver
|
||||
*/
|
||||
if (!priv->base.prepared)
|
||||
if (!priv->prepared)
|
||||
return TRUE;
|
||||
|
||||
/* In X, multiple Drawables can be stored in the same Pixmap (such as
|
||||
|
@ -65,28 +65,28 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
|||
* As a result, when doing a series of mappings for a fallback, we may
|
||||
* need to add more boxes to the set of data we've downloaded, as we go.
|
||||
*/
|
||||
RegionSubtract(®ion, ®ion, &priv->base.prepare_region);
|
||||
RegionSubtract(®ion, ®ion, &priv->prepare_region);
|
||||
if (!RegionNotEmpty(®ion))
|
||||
return TRUE;
|
||||
|
||||
if (access == GLAMOR_ACCESS_RW)
|
||||
FatalError("attempt to remap buffer as writable");
|
||||
|
||||
if (priv->base.pbo) {
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->base.pbo);
|
||||
if (priv->pbo) {
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo);
|
||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
pixmap->devPrivate.ptr = NULL;
|
||||
}
|
||||
} else {
|
||||
RegionInit(&priv->base.prepare_region, box, 1);
|
||||
RegionInit(&priv->prepare_region, box, 1);
|
||||
|
||||
if (glamor_priv->has_rw_pbo) {
|
||||
if (priv->base.pbo == 0)
|
||||
glGenBuffers(1, &priv->base.pbo);
|
||||
if (priv->pbo == 0)
|
||||
glGenBuffers(1, &priv->pbo);
|
||||
|
||||
gl_usage = GL_STREAM_READ;
|
||||
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->base.pbo);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, priv->pbo);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER,
|
||||
pixmap->devKind * pixmap->drawable.height, NULL,
|
||||
gl_usage);
|
||||
|
@ -96,7 +96,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
|||
if (!pixmap->devPrivate.ptr)
|
||||
return FALSE;
|
||||
}
|
||||
priv->base.map_access = access;
|
||||
priv->map_access = access;
|
||||
}
|
||||
|
||||
glamor_download_boxes(pixmap, RegionRects(®ion), RegionNumRects(®ion),
|
||||
|
@ -105,7 +105,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
|||
RegionUninit(®ion);
|
||||
|
||||
if (glamor_priv->has_rw_pbo) {
|
||||
if (priv->base.map_access == GLAMOR_ACCESS_RW)
|
||||
if (priv->map_access == GLAMOR_ACCESS_RW)
|
||||
gl_access = GL_READ_WRITE;
|
||||
else
|
||||
gl_access = GL_READ_ONLY;
|
||||
|
@ -114,7 +114,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
|||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
}
|
||||
|
||||
priv->base.prepared = TRUE;
|
||||
priv->prepared = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -133,34 +133,34 @@ glamor_fini_pixmap(PixmapPtr pixmap)
|
|||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(priv))
|
||||
return;
|
||||
|
||||
if (!priv->base.prepared)
|
||||
if (!priv->prepared)
|
||||
return;
|
||||
|
||||
if (glamor_priv->has_rw_pbo) {
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->base.pbo);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, priv->pbo);
|
||||
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
|
||||
pixmap->devPrivate.ptr = NULL;
|
||||
}
|
||||
|
||||
if (priv->base.map_access == GLAMOR_ACCESS_RW) {
|
||||
if (priv->map_access == GLAMOR_ACCESS_RW) {
|
||||
glamor_upload_boxes(pixmap,
|
||||
RegionRects(&priv->base.prepare_region),
|
||||
RegionNumRects(&priv->base.prepare_region),
|
||||
RegionRects(&priv->prepare_region),
|
||||
RegionNumRects(&priv->prepare_region),
|
||||
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
|
||||
}
|
||||
|
||||
RegionUninit(&priv->base.prepare_region);
|
||||
RegionUninit(&priv->prepare_region);
|
||||
|
||||
if (glamor_priv->has_rw_pbo) {
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
glDeleteBuffers(1, &priv->base.pbo);
|
||||
priv->base.pbo = 0;
|
||||
glDeleteBuffers(1, &priv->pbo);
|
||||
priv->pbo = 0;
|
||||
} else {
|
||||
free(pixmap->devPrivate.ptr);
|
||||
pixmap->devPrivate.ptr = NULL;
|
||||
}
|
||||
|
||||
priv->base.prepared = FALSE;
|
||||
priv->prepared = FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
|
|
|
@ -48,9 +48,7 @@
|
|||
"precision mediump float;\n" \
|
||||
"#endif\n"
|
||||
|
||||
#ifdef RENDER
|
||||
#include "glyphstr.h"
|
||||
#endif
|
||||
|
||||
#include "glamor_debug.h"
|
||||
#include "glamor_context.h"
|
||||
|
@ -74,7 +72,7 @@ typedef struct glamor_composite_shader {
|
|||
union {
|
||||
float source_solid_color[4];
|
||||
struct {
|
||||
struct glamor_pixmap_private *source_priv;
|
||||
PixmapPtr source_pixmap;
|
||||
PicturePtr source;
|
||||
};
|
||||
};
|
||||
|
@ -82,7 +80,7 @@ typedef struct glamor_composite_shader {
|
|||
union {
|
||||
float mask_solid_color[4];
|
||||
struct {
|
||||
struct glamor_pixmap_private *mask_priv;
|
||||
PixmapPtr mask_pixmap;
|
||||
PicturePtr mask;
|
||||
};
|
||||
};
|
||||
|
@ -236,6 +234,8 @@ typedef struct glamor_screen_private {
|
|||
int has_buffer_storage;
|
||||
int has_khr_debug;
|
||||
int has_nv_texture_barrier;
|
||||
int has_pack_subimage;
|
||||
int has_unpack_subimage;
|
||||
int max_fbo_size;
|
||||
int has_rw_pbo;
|
||||
|
||||
|
@ -369,7 +369,6 @@ typedef struct glamor_pixmap_fbo {
|
|||
Bool external;
|
||||
GLenum format;
|
||||
GLenum type;
|
||||
glamor_screen_private *glamor_priv;
|
||||
} glamor_pixmap_fbo;
|
||||
|
||||
/*
|
||||
|
@ -378,6 +377,14 @@ typedef struct glamor_pixmap_fbo {
|
|||
* @is_picture: The drawable is attached to a picture.
|
||||
* @pict_format: the corresponding picture's format.
|
||||
* @pixmap: The corresponding pixmap's pointer.
|
||||
* @box: current fbo's coords in the whole pixmap.
|
||||
* @block_w: block width of this large pixmap.
|
||||
* @block_h: block height of this large pixmap.
|
||||
* @block_wcnt: block count in one block row.
|
||||
* @block_hcnt: block count in one block column.
|
||||
* @nbox: total block count.
|
||||
* @box_array: contains each block's corresponding box.
|
||||
* @fbo_array: contains each block's fbo pointer.
|
||||
*
|
||||
* For GLAMOR_TEXTURE_LARGE, nbox should larger than 1.
|
||||
* And the box and fbo will both have nbox elements.
|
||||
|
@ -427,9 +434,6 @@ typedef struct glamor_pixmap_fbo {
|
|||
* to the box and fbo elements. Thus the inner routines
|
||||
* can handle it as normal, only the coords calculation need
|
||||
* to aware of it's large pixmap.
|
||||
*
|
||||
* Currently, we haven't implemented the atlas pixmap.
|
||||
*
|
||||
**/
|
||||
|
||||
typedef struct glamor_pixmap_clipped_regions {
|
||||
|
@ -437,7 +441,7 @@ typedef struct glamor_pixmap_clipped_regions {
|
|||
RegionPtr region;
|
||||
} glamor_pixmap_clipped_regions;
|
||||
|
||||
typedef struct glamor_pixmap_private_base {
|
||||
typedef struct glamor_pixmap_private {
|
||||
glamor_pixmap_type_t type;
|
||||
enum glamor_fbo_state gl_fbo;
|
||||
/**
|
||||
|
@ -449,10 +453,8 @@ typedef struct glamor_pixmap_private_base {
|
|||
unsigned char is_picture:1;
|
||||
unsigned char gl_tex:1;
|
||||
glamor_pixmap_fbo *fbo;
|
||||
PixmapPtr pixmap;
|
||||
BoxRec box;
|
||||
int drm_stride;
|
||||
glamor_screen_private *glamor_priv;
|
||||
PicturePtr picture;
|
||||
GLuint pbo;
|
||||
RegionRec prepare_region;
|
||||
|
@ -460,104 +462,125 @@ typedef struct glamor_pixmap_private_base {
|
|||
#if GLAMOR_HAS_GBM
|
||||
EGLImageKHR image;
|
||||
#endif
|
||||
} glamor_pixmap_private_base_t;
|
||||
|
||||
/*
|
||||
* @base.fbo: current fbo.
|
||||
* @box: current fbo's coords in the whole pixmap.
|
||||
* @block_w: block width of this large pixmap.
|
||||
* @block_h: block height of this large pixmap.
|
||||
* @block_wcnt: block count in one block row.
|
||||
* @block_hcnt: block count in one block column.
|
||||
* @nbox: total block count.
|
||||
* @box_array: contains each block's corresponding box.
|
||||
* @fbo_array: contains each block's fbo pointer.
|
||||
*
|
||||
**/
|
||||
typedef struct glamor_pixmap_private_large {
|
||||
union {
|
||||
glamor_pixmap_type_t type;
|
||||
glamor_pixmap_private_base_t base;
|
||||
};
|
||||
BoxRec box;
|
||||
int block_w;
|
||||
int block_h;
|
||||
int block_wcnt;
|
||||
int block_hcnt;
|
||||
int nbox;
|
||||
BoxPtr box_array;
|
||||
glamor_pixmap_fbo **fbo_array;
|
||||
} glamor_pixmap_private_large_t;
|
||||
} glamor_pixmap_private;
|
||||
|
||||
extern DevPrivateKeyRec glamor_pixmap_private_key;
|
||||
|
||||
static inline glamor_pixmap_private *
|
||||
glamor_get_pixmap_private(PixmapPtr pixmap)
|
||||
{
|
||||
glamor_pixmap_private *priv;
|
||||
|
||||
if (pixmap == NULL)
|
||||
return NULL;
|
||||
|
||||
priv = dixLookupPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key);
|
||||
if (!priv) {
|
||||
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
|
||||
priv = dixLookupPrivate(&pixmap->devPrivates,
|
||||
&glamor_pixmap_private_key);
|
||||
}
|
||||
return priv;
|
||||
}
|
||||
|
||||
void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv);
|
||||
|
||||
/*
|
||||
* @box: the relative coords in the corresponding fbo.
|
||||
* Returns TRUE if pixmap has no image object
|
||||
*/
|
||||
typedef struct glamor_pixmap_private_atlas {
|
||||
union {
|
||||
glamor_pixmap_type_t type;
|
||||
glamor_pixmap_private_base_t base;
|
||||
};
|
||||
BoxRec box;
|
||||
} glamor_pixmap_private_atlas_t;
|
||||
static inline Bool
|
||||
glamor_pixmap_drm_only(PixmapPtr pixmap)
|
||||
{
|
||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
typedef struct glamor_pixmap_private {
|
||||
union {
|
||||
glamor_pixmap_type_t type;
|
||||
glamor_pixmap_private_base_t base;
|
||||
glamor_pixmap_private_large_t large;
|
||||
glamor_pixmap_private_atlas_t atlas;
|
||||
};
|
||||
} glamor_pixmap_private;
|
||||
return priv && priv->type == GLAMOR_DRM_ONLY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns TRUE if pixmap is plain memory (not a GL object at all)
|
||||
*/
|
||||
static inline Bool
|
||||
glamor_pixmap_is_memory(PixmapPtr pixmap)
|
||||
{
|
||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
return !priv || priv->type == GLAMOR_MEMORY;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns TRUE if pixmap requires multiple textures to hold it
|
||||
*/
|
||||
static inline Bool
|
||||
glamor_pixmap_priv_is_large(glamor_pixmap_private *priv)
|
||||
{
|
||||
return priv && (priv->block_wcnt > 1 || priv->block_hcnt > 1);
|
||||
}
|
||||
|
||||
static inline Bool
|
||||
glamor_pixmap_priv_is_small(glamor_pixmap_private *priv)
|
||||
{
|
||||
return priv && priv->block_wcnt <= 1 && priv->block_hcnt <= 1;
|
||||
}
|
||||
|
||||
static inline Bool
|
||||
glamor_pixmap_is_large(PixmapPtr pixmap)
|
||||
{
|
||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
return priv && glamor_pixmap_priv_is_large(priv);
|
||||
}
|
||||
/*
|
||||
* Returns TRUE if pixmap has an FBO
|
||||
*/
|
||||
static inline Bool
|
||||
glamor_pixmap_has_fbo(PixmapPtr pixmap)
|
||||
{
|
||||
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
return priv && priv->gl_fbo == GLAMOR_FBO_NORMAL;
|
||||
}
|
||||
|
||||
static inline void
|
||||
glamor_set_pixmap_fbo_current(glamor_pixmap_private *priv, int idx)
|
||||
{
|
||||
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
priv->large.base.fbo = priv->large.fbo_array[idx];
|
||||
priv->large.box = priv->large.box_array[idx];
|
||||
if (glamor_pixmap_priv_is_large(priv)) {
|
||||
priv->fbo = priv->fbo_array[idx];
|
||||
priv->box = priv->box_array[idx];
|
||||
}
|
||||
}
|
||||
|
||||
static inline glamor_pixmap_fbo *
|
||||
glamor_pixmap_fbo_at(glamor_pixmap_private *priv, int x, int y)
|
||||
{
|
||||
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
assert(x < priv->large.block_wcnt);
|
||||
assert(y < priv->large.block_hcnt);
|
||||
return priv->large.fbo_array[y * priv->large.block_wcnt + x];
|
||||
}
|
||||
assert (x == 0);
|
||||
assert (y == 0);
|
||||
return priv->base.fbo;
|
||||
assert(x < priv->block_wcnt);
|
||||
assert(y < priv->block_hcnt);
|
||||
return priv->fbo_array[y * priv->block_wcnt + x];
|
||||
}
|
||||
|
||||
static inline BoxPtr
|
||||
glamor_pixmap_box_at(glamor_pixmap_private *priv, int x, int y)
|
||||
{
|
||||
if (priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
assert(x < priv->large.block_wcnt);
|
||||
assert(y < priv->large.block_hcnt);
|
||||
return &priv->large.box_array[y * priv->large.block_wcnt + x];
|
||||
}
|
||||
assert (x == 0);
|
||||
assert (y == 0);
|
||||
return &priv->base.box;
|
||||
assert(x < priv->block_wcnt);
|
||||
assert(y < priv->block_hcnt);
|
||||
return &priv->box_array[y * priv->block_wcnt + x];
|
||||
}
|
||||
|
||||
static inline int
|
||||
glamor_pixmap_wcnt(glamor_pixmap_private *priv)
|
||||
{
|
||||
if (priv->type == GLAMOR_TEXTURE_LARGE)
|
||||
return priv->large.block_wcnt;
|
||||
return 1;
|
||||
return priv->block_wcnt;
|
||||
}
|
||||
|
||||
static inline int
|
||||
glamor_pixmap_hcnt(glamor_pixmap_private *priv)
|
||||
{
|
||||
if (priv->type == GLAMOR_TEXTURE_LARGE)
|
||||
return priv->large.block_hcnt;
|
||||
return 1;
|
||||
return priv->block_hcnt;
|
||||
}
|
||||
|
||||
#define glamor_pixmap_loop(priv, x, y) \
|
||||
|
@ -590,7 +613,6 @@ typedef struct {
|
|||
|
||||
extern DevPrivateKeyRec glamor_gc_private_key;
|
||||
extern DevPrivateKeyRec glamor_screen_private_key;
|
||||
extern DevPrivateKeyRec glamor_pixmap_private_key;
|
||||
|
||||
static inline glamor_screen_private *
|
||||
glamor_get_screen_private(ScreenPtr screen)
|
||||
|
@ -605,22 +627,6 @@ glamor_set_screen_private(ScreenPtr screen, glamor_screen_private *priv)
|
|||
dixSetPrivate(&screen->devPrivates, &glamor_screen_private_key, priv);
|
||||
}
|
||||
|
||||
static inline glamor_pixmap_private *
|
||||
glamor_get_pixmap_private(PixmapPtr pixmap)
|
||||
{
|
||||
glamor_pixmap_private *priv;
|
||||
|
||||
priv = dixLookupPrivate(&pixmap->devPrivates, &glamor_pixmap_private_key);
|
||||
if (!priv) {
|
||||
glamor_set_pixmap_type(pixmap, GLAMOR_MEMORY);
|
||||
priv = dixLookupPrivate(&pixmap->devPrivates,
|
||||
&glamor_pixmap_private_key);
|
||||
}
|
||||
return priv;
|
||||
}
|
||||
|
||||
void glamor_set_pixmap_private(PixmapPtr pixmap, glamor_pixmap_private *priv);
|
||||
|
||||
static inline glamor_gc_private *
|
||||
glamor_get_gc_private(GCPtr gc)
|
||||
{
|
||||
|
@ -652,9 +658,10 @@ glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private *
|
|||
int flag);
|
||||
glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
|
||||
int h, GLenum format, int flag);
|
||||
void glamor_destroy_fbo(glamor_pixmap_fbo *fbo);
|
||||
void glamor_pixmap_destroy_fbo(glamor_pixmap_private *priv);
|
||||
|
||||
void glamor_destroy_fbo(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_fbo *fbo);
|
||||
void glamor_pixmap_destroy_fbo(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_private *priv);
|
||||
void glamor_init_pixmap_fbo(ScreenPtr screen);
|
||||
void glamor_fini_pixmap_fbo(ScreenPtr screen);
|
||||
Bool glamor_pixmap_fbo_fixup(ScreenPtr screen, PixmapPtr pixmap);
|
||||
|
@ -679,13 +686,13 @@ void glamor_get_color_4f_from_pixel(PixmapPtr pixmap,
|
|||
unsigned long fg_pixel, GLfloat *color);
|
||||
|
||||
int glamor_set_destination_pixmap(PixmapPtr pixmap);
|
||||
int glamor_set_destination_pixmap_priv(glamor_pixmap_private *pixmap_priv);
|
||||
void glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo *, int, int, int, int);
|
||||
int glamor_set_destination_pixmap_priv(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv);
|
||||
void glamor_set_destination_pixmap_fbo(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *, int, int, int, int);
|
||||
|
||||
/* nc means no check. caller must ensure this pixmap has valid fbo.
|
||||
* usually use the GLAMOR_PIXMAP_PRIV_HAS_FBO firstly.
|
||||
* */
|
||||
void glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private *pixmap_priv);
|
||||
void glamor_set_destination_pixmap_priv_nc(glamor_screen_private *glamor_priv, PixmapPtr pixmap, glamor_pixmap_private *pixmap_priv);
|
||||
|
||||
glamor_pixmap_fbo *glamor_es2_pixmap_read_prepare(PixmapPtr source, int x,
|
||||
int y, int w, int h,
|
||||
|
@ -702,6 +709,7 @@ glamor_track_stipple(GCPtr gc);
|
|||
|
||||
/* glamor_glyphs.c */
|
||||
Bool glamor_realize_glyph_caches(ScreenPtr screen);
|
||||
void glamor_glyph_unrealize(ScreenPtr screen, GlyphPtr glyph);
|
||||
void glamor_glyphs_fini(ScreenPtr screen);
|
||||
void glamor_glyphs(CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
|
@ -715,9 +723,9 @@ Bool glamor_composite_clipped_region(CARD8 op,
|
|||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
glamor_pixmap_private *soruce_pixmap_priv,
|
||||
glamor_pixmap_private *mask_pixmap_priv,
|
||||
glamor_pixmap_private *dest_pixmap_priv,
|
||||
PixmapPtr source_pixmap,
|
||||
PixmapPtr mask_pixmap,
|
||||
PixmapPtr dest_pixmap,
|
||||
RegionPtr region,
|
||||
int x_source,
|
||||
int y_source,
|
||||
|
@ -748,23 +756,6 @@ PicturePtr glamor_convert_gradient_picture(ScreenPtr screen,
|
|||
int x_source,
|
||||
int y_source, int width, int height);
|
||||
|
||||
Bool glamor_composite_choose_shader(CARD8 op,
|
||||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
glamor_pixmap_private *source_pixmap_priv,
|
||||
glamor_pixmap_private *mask_pixmap_priv,
|
||||
glamor_pixmap_private *dest_pixmap_priv,
|
||||
struct shader_key *s_key,
|
||||
glamor_composite_shader ** shader,
|
||||
struct blendinfo *op_info,
|
||||
PictFormatShort *psaved_source_format);
|
||||
|
||||
void glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
||||
struct shader_key *key,
|
||||
glamor_composite_shader *shader,
|
||||
struct blendinfo *op_info);
|
||||
|
||||
void *glamor_setup_composite_vbo(ScreenPtr screen, int n_verts);
|
||||
|
||||
/* glamor_trapezoid.c */
|
||||
|
@ -831,19 +822,19 @@ Bool glamor_upload_sub_pixmap_to_texture(PixmapPtr pixmap, int x, int y, int w,
|
|||
int pbo);
|
||||
|
||||
glamor_pixmap_clipped_regions *
|
||||
glamor_compute_clipped_regions(glamor_pixmap_private *priv,
|
||||
glamor_compute_clipped_regions(PixmapPtr pixmap,
|
||||
RegionPtr region, int *clipped_nbox,
|
||||
int repeat_type, int reverse,
|
||||
int upsidedown);
|
||||
|
||||
glamor_pixmap_clipped_regions *
|
||||
glamor_compute_clipped_regions_ext(glamor_pixmap_private *pixmap_priv,
|
||||
glamor_compute_clipped_regions_ext(PixmapPtr pixmap,
|
||||
RegionPtr region, int *n_region,
|
||||
int inner_block_w, int inner_block_h,
|
||||
int reverse, int upsidedown);
|
||||
|
||||
glamor_pixmap_clipped_regions *
|
||||
glamor_compute_transform_clipped_regions(glamor_pixmap_private *priv,
|
||||
glamor_compute_transform_clipped_regions(PixmapPtr pixmap,
|
||||
struct pixman_transform *transform,
|
||||
RegionPtr region,
|
||||
int *n_region, int dx, int dy,
|
||||
|
@ -854,9 +845,9 @@ Bool glamor_composite_largepixmap_region(CARD8 op,
|
|||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
glamor_pixmap_private *source_pixmap_priv,
|
||||
glamor_pixmap_private *mask_pixmap_priv,
|
||||
glamor_pixmap_private *dest_pixmap_priv,
|
||||
PixmapPtr source_pixmap,
|
||||
PixmapPtr mask_pixmap,
|
||||
PixmapPtr dest_pixmap,
|
||||
RegionPtr region, Bool force_clip,
|
||||
INT16 x_source,
|
||||
INT16 y_source,
|
||||
|
@ -894,10 +885,6 @@ void glamor_set_window_pixmap(WindowPtr pWindow, PixmapPtr pPixmap);
|
|||
|
||||
void glamor_destroy_picture(PicturePtr picture);
|
||||
|
||||
/* fixup a fbo to the exact size as the pixmap. */
|
||||
Bool glamor_fixup_pixmap_priv(ScreenPtr screen,
|
||||
glamor_pixmap_private *pixmap_priv);
|
||||
|
||||
void glamor_picture_format_fixup(PicturePtr picture,
|
||||
glamor_pixmap_private *pixmap_priv);
|
||||
|
||||
|
@ -1095,4 +1082,6 @@ void glamor_xv_render(glamor_port_private *port_priv);
|
|||
|
||||
#include "glamor_font.h"
|
||||
|
||||
#define GLAMOR_MIN_ALU_INSTRUCTIONS 128 /* Minimum required number of native ALU instructions */
|
||||
|
||||
#endif /* GLAMOR_PRIV_H */
|
||||
|
|
|
@ -40,12 +40,12 @@ const glamor_facet glamor_fill_solid = {
|
|||
static Bool
|
||||
use_tile(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
|
||||
{
|
||||
return glamor_set_tiled(pixmap, gc, prog->fill_offset_uniform, prog->fill_size_uniform);
|
||||
return glamor_set_tiled(pixmap, gc, prog->fill_offset_uniform, prog->fill_size_inv_uniform);
|
||||
}
|
||||
|
||||
static const glamor_facet glamor_fill_tile = {
|
||||
.name = "tile",
|
||||
.vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n",
|
||||
.vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n",
|
||||
.fs_exec = " gl_FragColor = texture2D(sampler, fill_pos);\n",
|
||||
.locations = glamor_program_location_fill,
|
||||
.use = use_tile,
|
||||
|
@ -56,12 +56,12 @@ use_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
|
|||
{
|
||||
return glamor_set_stippled(pixmap, gc, prog->fg_uniform,
|
||||
prog->fill_offset_uniform,
|
||||
prog->fill_size_uniform);
|
||||
prog->fill_size_inv_uniform);
|
||||
}
|
||||
|
||||
static const glamor_facet glamor_fill_stipple = {
|
||||
.name = "stipple",
|
||||
.vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n",
|
||||
.vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n",
|
||||
.fs_exec = (" float a = texture2D(sampler, fill_pos).w;\n"
|
||||
" if (a == 0.0)\n"
|
||||
" discard;\n"
|
||||
|
@ -81,7 +81,7 @@ use_opaque_stipple(PixmapPtr pixmap, GCPtr gc, glamor_program *prog, void *arg)
|
|||
|
||||
static const glamor_facet glamor_fill_opaque_stipple = {
|
||||
.name = "opaque_stipple",
|
||||
.vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) / fill_size;\n",
|
||||
.vs_exec = " fill_pos = (fill_offset + primitive.xy + pos) * fill_size_inv;\n",
|
||||
.fs_exec = (" float a = texture2D(sampler, fill_pos).w;\n"
|
||||
" if (a == 0.0)\n"
|
||||
" gl_FragColor = bg;\n"
|
||||
|
@ -116,10 +116,10 @@ static glamor_location_var location_vars[] = {
|
|||
{
|
||||
.location = glamor_program_location_fill,
|
||||
.vs_vars = ("uniform vec2 fill_offset;\n"
|
||||
"uniform vec2 fill_size;\n"
|
||||
"uniform vec2 fill_size_inv;\n"
|
||||
"varying vec2 fill_pos;\n"),
|
||||
.fs_vars = ("uniform sampler2D sampler;\n"
|
||||
"uniform vec2 fill_size;\n"
|
||||
"uniform vec2 fill_size_inv;\n"
|
||||
"varying vec2 fill_pos;\n")
|
||||
},
|
||||
{
|
||||
|
@ -336,16 +336,13 @@ glamor_build_program(ScreenPtr screen,
|
|||
prog->fg_uniform = glamor_get_uniform(prog, glamor_program_location_fg, "fg");
|
||||
prog->bg_uniform = glamor_get_uniform(prog, glamor_program_location_bg, "bg");
|
||||
prog->fill_offset_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_offset");
|
||||
prog->fill_size_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_size");
|
||||
prog->fill_size_inv_uniform = glamor_get_uniform(prog, glamor_program_location_fill, "fill_size_inv");
|
||||
prog->font_uniform = glamor_get_uniform(prog, glamor_program_location_font, "font");
|
||||
prog->bitplane_uniform = glamor_get_uniform(prog, glamor_program_location_bitplane, "bitplane");
|
||||
prog->bitmul_uniform = glamor_get_uniform(prog, glamor_program_location_bitplane, "bitmul");
|
||||
prog->dash_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash");
|
||||
prog->dash_length_uniform = glamor_get_uniform(prog, glamor_program_location_dash, "dash_length");
|
||||
|
||||
if (glGetError() != GL_NO_ERROR)
|
||||
goto fail;
|
||||
|
||||
free(version_string);
|
||||
free(fs_vars);
|
||||
free(vs_vars);
|
||||
|
|
|
@ -60,7 +60,7 @@ struct _glamor_program {
|
|||
GLint matrix_uniform;
|
||||
GLint fg_uniform;
|
||||
GLint bg_uniform;
|
||||
GLint fill_size_uniform;
|
||||
GLint fill_size_inv_uniform;
|
||||
GLint fill_offset_uniform;
|
||||
GLint font_uniform;
|
||||
GLint bitplane_uniform;
|
||||
|
|
|
@ -65,7 +65,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
|||
&glamor_facet_polyfillrect_130);
|
||||
|
||||
if (!prog)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
/* Set up the vertex buffers for the points */
|
||||
|
||||
|
@ -87,7 +87,7 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
|||
&glamor_facet_polyfillrect_120);
|
||||
|
||||
if (!prog)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
/* Set up the vertex buffers for the points */
|
||||
|
||||
|
@ -126,27 +126,17 @@ glamor_poly_fill_rect_gl(DrawablePtr drawable,
|
|||
if (glamor_priv->glsl_version >= 130)
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, nrect);
|
||||
else {
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
||||
glDrawArrays(GL_QUADS, 0, nrect * 4);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < nrect; i++) {
|
||||
glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
|
||||
}
|
||||
}
|
||||
glamor_glDrawArrays_GL_QUADS(glamor_priv, nrect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
if (glamor_priv->glsl_version >= 130)
|
||||
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
return TRUE;
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -173,15 +163,3 @@ glamor_poly_fill_rect(DrawablePtr drawable,
|
|||
return;
|
||||
glamor_poly_fill_rect_bail(drawable, gc, nrect, prect);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_poly_fill_rect_nf(DrawablePtr drawable,
|
||||
GCPtr gc, int nrect, xRectangle *prect)
|
||||
{
|
||||
if (glamor_poly_fill_rect_gl(drawable, gc, nrect, prect))
|
||||
return TRUE;
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
|
||||
return FALSE;
|
||||
glamor_poly_fill_rect_bail(drawable, gc, nrect, prect);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
|
||||
#include "glamor_priv.h"
|
||||
|
||||
#ifdef RENDER
|
||||
#include "mipict.h"
|
||||
#include "fbpict.h"
|
||||
#if 0
|
||||
|
@ -483,15 +482,16 @@ glamor_set_composite_op(ScreenPtr screen,
|
|||
static void
|
||||
glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
||||
PicturePtr picture,
|
||||
glamor_pixmap_private *pixmap_priv,
|
||||
PixmapPtr pixmap,
|
||||
GLuint wh_location, GLuint repeat_location)
|
||||
{
|
||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
float wh[4];
|
||||
int repeat_type;
|
||||
|
||||
glamor_make_current(glamor_priv);
|
||||
glActiveTexture(GL_TEXTURE0 + unit);
|
||||
glBindTexture(GL_TEXTURE_2D, pixmap_priv->base.fbo->tex);
|
||||
glBindTexture(GL_TEXTURE_2D, pixmap_priv->fbo->tex);
|
||||
repeat_type = picture->repeatType;
|
||||
switch (picture->repeatType) {
|
||||
case RepeatNone:
|
||||
|
@ -542,13 +542,12 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
|||
if (repeat_type != RepeatNone)
|
||||
repeat_type += RepeatFix;
|
||||
else if (glamor_priv->gl_flavor == GLAMOR_GL_ES2
|
||||
|| pixmap_priv->type == GLAMOR_TEXTURE_LARGE) {
|
||||
if (picture->transform
|
||||
|| (GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(pixmap_priv)))
|
||||
|| glamor_pixmap_priv_is_large(pixmap_priv)) {
|
||||
if (picture->transform)
|
||||
repeat_type += RepeatFix;
|
||||
}
|
||||
if (repeat_type >= RepeatFix) {
|
||||
glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap_priv);
|
||||
glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, pixmap_priv);
|
||||
if ((wh[0] != 1.0 || wh[1] != 1.0)
|
||||
|| (glamor_priv->gl_flavor == GLAMOR_GL_ES2
|
||||
&& repeat_type == RepeatFix))
|
||||
|
@ -788,7 +787,8 @@ combine_pict_format(PictFormatShort * des, const PictFormatShort src,
|
|||
}
|
||||
|
||||
static void
|
||||
glamor_set_normalize_tcoords_generic(glamor_pixmap_private *priv,
|
||||
glamor_set_normalize_tcoords_generic(PixmapPtr pixmap,
|
||||
glamor_pixmap_private *priv,
|
||||
int repeat_type,
|
||||
float *matrix,
|
||||
float xscale, float yscale,
|
||||
|
@ -806,24 +806,27 @@ glamor_set_normalize_tcoords_generic(glamor_pixmap_private *priv,
|
|||
x2, y2,
|
||||
texcoords, stride);
|
||||
else if (!matrix && repeat_type != RepeatNone)
|
||||
glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type,
|
||||
glamor_set_repeat_normalize_tcoords_ext(pixmap, priv, repeat_type,
|
||||
xscale, yscale,
|
||||
x1, y1,
|
||||
x2, y2,
|
||||
texcoords, stride);
|
||||
else if (matrix && repeat_type != RepeatNone)
|
||||
glamor_set_repeat_transformed_normalize_tcoords_ext(priv, repeat_type,
|
||||
glamor_set_repeat_transformed_normalize_tcoords_ext(pixmap, priv, repeat_type,
|
||||
matrix, xscale,
|
||||
yscale, x1, y1, x2,
|
||||
y2,
|
||||
texcoords, stride);
|
||||
}
|
||||
|
||||
Bool
|
||||
static Bool
|
||||
glamor_composite_choose_shader(CARD8 op,
|
||||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
PixmapPtr source_pixmap,
|
||||
PixmapPtr mask_pixmap,
|
||||
PixmapPtr dest_pixmap,
|
||||
glamor_pixmap_private *source_pixmap_priv,
|
||||
glamor_pixmap_private *mask_pixmap_priv,
|
||||
glamor_pixmap_private *dest_pixmap_priv,
|
||||
|
@ -833,9 +836,6 @@ glamor_composite_choose_shader(CARD8 op,
|
|||
PictFormatShort *psaved_source_format)
|
||||
{
|
||||
ScreenPtr screen = dest->pDrawable->pScreen;
|
||||
PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap;
|
||||
PixmapPtr source_pixmap = NULL;
|
||||
PixmapPtr mask_pixmap = NULL;
|
||||
enum glamor_pixmap_status source_status = GLAMOR_NONE;
|
||||
enum glamor_pixmap_status mask_status = GLAMOR_NONE;
|
||||
PictFormatShort saved_source_format = 0;
|
||||
|
@ -928,13 +928,12 @@ glamor_composite_choose_shader(CARD8 op,
|
|||
|
||||
if (key.source == SHADER_SOURCE_TEXTURE ||
|
||||
key.source == SHADER_SOURCE_TEXTURE_ALPHA) {
|
||||
source_pixmap = source_pixmap_priv->base.pixmap;
|
||||
if (source_pixmap == dest_pixmap) {
|
||||
/* XXX source and the dest share the same texture.
|
||||
* Does it need special handle? */
|
||||
glamor_fallback("source == dest\n");
|
||||
}
|
||||
if (source_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
|
||||
if (source_pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) {
|
||||
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
|
||||
source_status = GLAMOR_UPLOAD_PENDING;
|
||||
#else
|
||||
|
@ -946,12 +945,11 @@ glamor_composite_choose_shader(CARD8 op,
|
|||
|
||||
if (key.mask == SHADER_MASK_TEXTURE ||
|
||||
key.mask == SHADER_MASK_TEXTURE_ALPHA) {
|
||||
mask_pixmap = mask_pixmap_priv->base.pixmap;
|
||||
if (mask_pixmap == dest_pixmap) {
|
||||
glamor_fallback("mask == dest\n");
|
||||
goto fail;
|
||||
}
|
||||
if (mask_pixmap_priv->base.gl_fbo == GLAMOR_FBO_UNATTACHED) {
|
||||
if (mask_pixmap_priv->gl_fbo == GLAMOR_FBO_UNATTACHED) {
|
||||
#ifdef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
|
||||
mask_status = GLAMOR_UPLOAD_PENDING;
|
||||
#else
|
||||
|
@ -1041,23 +1039,6 @@ glamor_composite_choose_shader(CARD8 op,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
/*Before enter the rendering stage, we need to fixup
|
||||
* transformed source and mask, if the transform is not int translate. */
|
||||
if (key.source != SHADER_SOURCE_SOLID
|
||||
&& source->transform
|
||||
&& !pixman_transform_is_int_translate(source->transform)
|
||||
&& source_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
|
||||
if (!glamor_fixup_pixmap_priv(screen, source_pixmap_priv))
|
||||
goto fail;
|
||||
}
|
||||
if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID
|
||||
&& mask->transform
|
||||
&& !pixman_transform_is_int_translate(mask->transform)
|
||||
&& mask_pixmap_priv->type != GLAMOR_TEXTURE_LARGE) {
|
||||
if (!glamor_fixup_pixmap_priv(screen, mask_pixmap_priv))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!glamor_set_composite_op(screen, op, op_info, dest, mask))
|
||||
goto fail;
|
||||
|
||||
|
@ -1071,7 +1052,7 @@ glamor_composite_choose_shader(CARD8 op,
|
|||
memcpy(&(*shader)->source_solid_color[0],
|
||||
source_solid_color, 4 * sizeof(float));
|
||||
else {
|
||||
(*shader)->source_priv = source_pixmap_priv;
|
||||
(*shader)->source_pixmap = source_pixmap;
|
||||
(*shader)->source = source;
|
||||
}
|
||||
|
||||
|
@ -1079,7 +1060,7 @@ glamor_composite_choose_shader(CARD8 op,
|
|||
memcpy(&(*shader)->mask_solid_color[0],
|
||||
mask_solid_color, 4 * sizeof(float));
|
||||
else {
|
||||
(*shader)->mask_priv = mask_pixmap_priv;
|
||||
(*shader)->mask_pixmap = mask_pixmap;
|
||||
(*shader)->mask = mask;
|
||||
}
|
||||
|
||||
|
@ -1095,16 +1076,13 @@ glamor_composite_choose_shader(CARD8 op,
|
|||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
||||
static void
|
||||
glamor_composite_set_shader_blend(glamor_screen_private *glamor_priv,
|
||||
glamor_pixmap_private *dest_priv,
|
||||
struct shader_key *key,
|
||||
glamor_composite_shader *shader,
|
||||
struct blendinfo *op_info)
|
||||
{
|
||||
glamor_screen_private *glamor_priv;
|
||||
|
||||
glamor_priv = dest_priv->base.glamor_priv;
|
||||
|
||||
glamor_make_current(glamor_priv);
|
||||
glUseProgram(shader->prog);
|
||||
|
||||
|
@ -1115,7 +1093,7 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
|||
else {
|
||||
glamor_set_composite_texture(glamor_priv, 0,
|
||||
shader->source,
|
||||
shader->source_priv, shader->source_wh,
|
||||
shader->source_pixmap, shader->source_wh,
|
||||
shader->source_repeat_mode);
|
||||
}
|
||||
|
||||
|
@ -1127,7 +1105,7 @@ glamor_composite_set_shader_blend(glamor_pixmap_private *dest_priv,
|
|||
else {
|
||||
glamor_set_composite_texture(glamor_priv, 1,
|
||||
shader->mask,
|
||||
shader->mask_priv, shader->mask_wh,
|
||||
shader->mask_pixmap, shader->mask_wh,
|
||||
shader->mask_repeat_mode);
|
||||
}
|
||||
}
|
||||
|
@ -1146,6 +1124,9 @@ glamor_composite_with_shader(CARD8 op,
|
|||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
PixmapPtr source_pixmap,
|
||||
PixmapPtr mask_pixmap,
|
||||
PixmapPtr dest_pixmap,
|
||||
glamor_pixmap_private *source_pixmap_priv,
|
||||
glamor_pixmap_private *mask_pixmap_priv,
|
||||
glamor_pixmap_private *dest_pixmap_priv,
|
||||
|
@ -1153,10 +1134,7 @@ glamor_composite_with_shader(CARD8 op,
|
|||
Bool two_pass_ca)
|
||||
{
|
||||
ScreenPtr screen = dest->pDrawable->pScreen;
|
||||
glamor_screen_private *glamor_priv = dest_pixmap_priv->base.glamor_priv;
|
||||
PixmapPtr dest_pixmap = dest_pixmap_priv->base.pixmap;
|
||||
PixmapPtr source_pixmap = NULL;
|
||||
PixmapPtr mask_pixmap = NULL;
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
GLfloat dst_xscale, dst_yscale;
|
||||
GLfloat mask_xscale = 1, mask_yscale = 1, src_xscale = 1, src_yscale = 1;
|
||||
struct shader_key key, key_ca;
|
||||
|
@ -1172,6 +1150,7 @@ glamor_composite_with_shader(CARD8 op,
|
|||
struct blendinfo op_info, op_info_ca;
|
||||
|
||||
if (!glamor_composite_choose_shader(op, source, mask, dest,
|
||||
source_pixmap, mask_pixmap, dest_pixmap,
|
||||
source_pixmap_priv, mask_pixmap_priv,
|
||||
dest_pixmap_priv,
|
||||
&key, &shader, &op_info,
|
||||
|
@ -1181,6 +1160,7 @@ glamor_composite_with_shader(CARD8 op,
|
|||
}
|
||||
if (two_pass_ca) {
|
||||
if (!glamor_composite_choose_shader(PictOpAdd, source, mask, dest,
|
||||
source_pixmap, mask_pixmap, dest_pixmap,
|
||||
source_pixmap_priv,
|
||||
mask_pixmap_priv, dest_pixmap_priv,
|
||||
&key_ca, &shader_ca, &op_info_ca,
|
||||
|
@ -1190,8 +1170,9 @@ glamor_composite_with_shader(CARD8 op,
|
|||
}
|
||||
}
|
||||
|
||||
glamor_set_destination_pixmap_priv_nc(dest_pixmap_priv);
|
||||
glamor_composite_set_shader_blend(dest_pixmap_priv, &key, shader, &op_info);
|
||||
glamor_set_destination_pixmap_priv_nc(glamor_priv, dest_pixmap, dest_pixmap_priv);
|
||||
glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv, &key, shader, &op_info);
|
||||
glamor_set_alu(screen, GXcopy);
|
||||
|
||||
glamor_make_current(glamor_priv);
|
||||
|
||||
|
@ -1203,10 +1184,9 @@ glamor_composite_with_shader(CARD8 op,
|
|||
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||
glamor_get_drawable_deltas(dest->pDrawable, dest_pixmap,
|
||||
&dest_x_off, &dest_y_off);
|
||||
pixmap_priv_get_dest_scale(dest_pixmap_priv, &dst_xscale, &dst_yscale);
|
||||
pixmap_priv_get_dest_scale(dest_pixmap, dest_pixmap_priv, &dst_xscale, &dst_yscale);
|
||||
|
||||
if (glamor_priv->has_source_coords) {
|
||||
source_pixmap = source_pixmap_priv->base.pixmap;
|
||||
glamor_get_drawable_deltas(source->pDrawable,
|
||||
source_pixmap, &source_x_off, &source_y_off);
|
||||
pixmap_priv_get_scale(source_pixmap_priv, &src_xscale, &src_yscale);
|
||||
|
@ -1217,7 +1197,6 @@ glamor_composite_with_shader(CARD8 op,
|
|||
}
|
||||
|
||||
if (glamor_priv->has_mask_coords) {
|
||||
mask_pixmap = mask_pixmap_priv->base.pixmap;
|
||||
glamor_get_drawable_deltas(mask->pDrawable, mask_pixmap,
|
||||
&mask_x_off, &mask_y_off);
|
||||
pixmap_priv_get_scale(mask_pixmap_priv, &mask_xscale, &mask_yscale);
|
||||
|
@ -1269,7 +1248,8 @@ glamor_composite_with_shader(CARD8 op,
|
|||
vb_stride);
|
||||
vertices += 2;
|
||||
if (key.source != SHADER_SOURCE_SOLID) {
|
||||
glamor_set_normalize_tcoords_generic(source_pixmap_priv,
|
||||
glamor_set_normalize_tcoords_generic(source_pixmap,
|
||||
source_pixmap_priv,
|
||||
source->repeatType,
|
||||
psrc_matrix, src_xscale,
|
||||
src_yscale, x_source,
|
||||
|
@ -1280,7 +1260,8 @@ glamor_composite_with_shader(CARD8 op,
|
|||
}
|
||||
|
||||
if (key.mask != SHADER_MASK_NONE && key.mask != SHADER_MASK_SOLID) {
|
||||
glamor_set_normalize_tcoords_generic(mask_pixmap_priv,
|
||||
glamor_set_normalize_tcoords_generic(mask_pixmap,
|
||||
mask_pixmap_priv,
|
||||
mask->repeatType,
|
||||
pmask_matrix, mask_xscale,
|
||||
mask_yscale, x_mask,
|
||||
|
@ -1299,11 +1280,11 @@ glamor_composite_with_shader(CARD8 op,
|
|||
glamor_flush_composite_rects(screen);
|
||||
nrect -= rect_processed;
|
||||
if (two_pass_ca) {
|
||||
glamor_composite_set_shader_blend(dest_pixmap_priv,
|
||||
glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv,
|
||||
&key_ca, shader_ca, &op_info_ca);
|
||||
glamor_flush_composite_rects(screen);
|
||||
if (nrect)
|
||||
glamor_composite_set_shader_blend(dest_pixmap_priv,
|
||||
glamor_composite_set_shader_blend(glamor_priv, dest_pixmap_priv,
|
||||
&key, shader, &op_info);
|
||||
}
|
||||
}
|
||||
|
@ -1390,17 +1371,21 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
glamor_pixmap_private *source_pixmap_priv,
|
||||
glamor_pixmap_private *mask_pixmap_priv,
|
||||
glamor_pixmap_private *dest_pixmap_priv,
|
||||
PixmapPtr source_pixmap,
|
||||
PixmapPtr mask_pixmap,
|
||||
PixmapPtr dest_pixmap,
|
||||
RegionPtr region,
|
||||
int x_source,
|
||||
int y_source,
|
||||
int x_mask, int y_mask, int x_dest, int y_dest)
|
||||
{
|
||||
glamor_pixmap_private *source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
|
||||
glamor_pixmap_private *mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
|
||||
glamor_pixmap_private *dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||
ScreenPtr screen = dest->pDrawable->pScreen;
|
||||
PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
|
||||
PicturePtr temp_src = source, temp_mask = mask;
|
||||
PixmapPtr temp_src_pixmap = source_pixmap;
|
||||
PixmapPtr temp_mask_pixmap = mask_pixmap;
|
||||
glamor_pixmap_private *temp_src_priv = source_pixmap_priv;
|
||||
glamor_pixmap_private *temp_mask_priv = mask_pixmap_priv;
|
||||
int x_temp_src, y_temp_src, x_temp_mask, y_temp_mask;
|
||||
|
@ -1430,12 +1415,6 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
DEBUGF("clipped (%d %d) (%d %d) (%d %d) width %d height %d \n",
|
||||
x_source, y_source, x_mask, y_mask, x_dest, y_dest, width, height);
|
||||
|
||||
if (source_pixmap_priv)
|
||||
source_pixmap = source_pixmap_priv->base.pixmap;
|
||||
|
||||
if (mask_pixmap_priv)
|
||||
mask_pixmap = mask_pixmap_priv->base.pixmap;
|
||||
|
||||
/* XXX is it possible source mask have non-zero drawable.x/y? */
|
||||
if (source
|
||||
&& ((!source->pDrawable
|
||||
|
@ -1453,8 +1432,8 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
temp_src = source;
|
||||
goto out;
|
||||
}
|
||||
temp_src_priv =
|
||||
glamor_get_pixmap_private((PixmapPtr) (temp_src->pDrawable));
|
||||
temp_src_pixmap = (PixmapPtr) (temp_src->pDrawable);
|
||||
temp_src_priv = glamor_get_pixmap_private(temp_src_pixmap);
|
||||
x_temp_src = -extent->x1 + x_dest + dest->pDrawable->x;
|
||||
y_temp_src = -extent->y1 + y_dest + dest->pDrawable->y;
|
||||
}
|
||||
|
@ -1477,8 +1456,8 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
temp_mask = mask;
|
||||
goto out;
|
||||
}
|
||||
temp_mask_priv =
|
||||
glamor_get_pixmap_private((PixmapPtr) (temp_mask->pDrawable));
|
||||
temp_mask_pixmap = (PixmapPtr) (temp_mask->pDrawable);
|
||||
temp_mask_priv = glamor_get_pixmap_private(temp_mask_pixmap);
|
||||
x_temp_mask = -extent->x1 + x_dest + dest->pDrawable->x;
|
||||
y_temp_mask = -extent->y1 + y_dest + dest->pDrawable->y;
|
||||
}
|
||||
|
@ -1540,6 +1519,7 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
DEBUGF("dest %d %d \n", prect[i].x_dst, prect[i].y_dst);
|
||||
}
|
||||
ok = glamor_composite_with_shader(op, temp_src, temp_mask, dest,
|
||||
temp_src_pixmap, temp_mask_pixmap, dest_pixmap,
|
||||
temp_src_priv, temp_mask_priv,
|
||||
dest_pixmap_priv,
|
||||
box_cnt, prect, two_pass_ca);
|
||||
|
@ -1560,8 +1540,8 @@ glamor_composite_clipped_region(CARD8 op,
|
|||
return ok;
|
||||
}
|
||||
|
||||
static Bool
|
||||
_glamor_composite(CARD8 op,
|
||||
void
|
||||
glamor_composite(CARD8 op,
|
||||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
|
@ -1569,34 +1549,26 @@ _glamor_composite(CARD8 op,
|
|||
INT16 y_source,
|
||||
INT16 x_mask,
|
||||
INT16 y_mask,
|
||||
INT16 x_dest, INT16 y_dest,
|
||||
CARD16 width, CARD16 height, Bool fallback)
|
||||
INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
|
||||
{
|
||||
ScreenPtr screen = dest->pDrawable->pScreen;
|
||||
glamor_pixmap_private *dest_pixmap_priv;
|
||||
glamor_pixmap_private *source_pixmap_priv = NULL, *mask_pixmap_priv = NULL;
|
||||
PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(dest->pDrawable);
|
||||
PixmapPtr source_pixmap = NULL, mask_pixmap = NULL;
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
Bool ret = TRUE;
|
||||
RegionRec region;
|
||||
BoxPtr extent;
|
||||
int nbox, ok = FALSE;
|
||||
int force_clip = 0;
|
||||
|
||||
dest_pixmap_priv = glamor_get_pixmap_private(dest_pixmap);
|
||||
|
||||
if (source->pDrawable) {
|
||||
source_pixmap = glamor_get_drawable_pixmap(source->pDrawable);
|
||||
source_pixmap_priv = glamor_get_pixmap_private(source_pixmap);
|
||||
if (source_pixmap_priv && source_pixmap_priv->type == GLAMOR_DRM_ONLY)
|
||||
if (glamor_pixmap_drm_only(source_pixmap))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (mask && mask->pDrawable) {
|
||||
mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable);
|
||||
mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
|
||||
if (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_DRM_ONLY)
|
||||
if (glamor_pixmap_drm_only(mask_pixmap))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -1605,9 +1577,8 @@ _glamor_composite(CARD8 op,
|
|||
source_pixmap, x_source, y_source, x_mask, y_mask, x_dest, y_dest,
|
||||
width, height);
|
||||
|
||||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(dest_pixmap_priv)) {
|
||||
if (!glamor_pixmap_has_fbo(dest_pixmap))
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (op >= ARRAY_SIZE(composite_op_info))
|
||||
goto fail;
|
||||
|
@ -1639,18 +1610,16 @@ _glamor_composite(CARD8 op,
|
|||
(mask_pixmap ? mask->pDrawable->y : 0),
|
||||
x_dest + dest->pDrawable->x,
|
||||
y_dest + dest->pDrawable->y, width, height)) {
|
||||
ret = TRUE;
|
||||
goto done;
|
||||
return;
|
||||
}
|
||||
|
||||
nbox = REGION_NUM_RECTS(®ion);
|
||||
DEBUGF("first clipped when compositing.\n");
|
||||
DEBUGRegionPrint(®ion);
|
||||
extent = RegionExtents(®ion);
|
||||
if (nbox == 0) {
|
||||
ret = TRUE;
|
||||
goto done;
|
||||
}
|
||||
if (nbox == 0)
|
||||
return;
|
||||
|
||||
/* If destination is not a large pixmap, but the region is larger
|
||||
* than texture size limitation, and source or mask is memory pixmap,
|
||||
* then there may be need to load a large memory pixmap to a
|
||||
|
@ -1659,28 +1628,28 @@ _glamor_composite(CARD8 op,
|
|||
* pixmap. */
|
||||
if (!glamor_check_fbo_size(glamor_priv,
|
||||
extent->x2 - extent->x1, extent->y2 - extent->y1)
|
||||
&& (dest_pixmap_priv->type != GLAMOR_TEXTURE_LARGE)
|
||||
&& ((source_pixmap_priv
|
||||
&& (source_pixmap_priv->type == GLAMOR_MEMORY ||
|
||||
&& glamor_pixmap_is_large(dest_pixmap)
|
||||
&& ((source_pixmap
|
||||
&& (glamor_pixmap_is_memory(source_pixmap) ||
|
||||
source->repeatType == RepeatPad))
|
||||
|| (mask_pixmap_priv &&
|
||||
(mask_pixmap_priv->type == GLAMOR_MEMORY ||
|
||||
|| (mask_pixmap &&
|
||||
(glamor_pixmap_is_memory(mask_pixmap) ||
|
||||
mask->repeatType == RepeatPad))
|
||||
|| (!source_pixmap_priv &&
|
||||
|| (!source_pixmap &&
|
||||
(source->pSourcePict->type != SourcePictTypeSolidFill))
|
||||
|| (!mask_pixmap_priv && mask &&
|
||||
|| (!mask_pixmap && mask &&
|
||||
mask->pSourcePict->type != SourcePictTypeSolidFill)))
|
||||
force_clip = 1;
|
||||
|
||||
if (force_clip || dest_pixmap_priv->type == GLAMOR_TEXTURE_LARGE
|
||||
|| (source_pixmap_priv
|
||||
&& source_pixmap_priv->type == GLAMOR_TEXTURE_LARGE)
|
||||
|| (mask_pixmap_priv && mask_pixmap_priv->type == GLAMOR_TEXTURE_LARGE))
|
||||
if (force_clip || glamor_pixmap_is_large(dest_pixmap)
|
||||
|| (source_pixmap
|
||||
&& glamor_pixmap_is_large(source_pixmap))
|
||||
|| (mask_pixmap && glamor_pixmap_is_large(mask_pixmap)))
|
||||
ok = glamor_composite_largepixmap_region(op,
|
||||
source, mask, dest,
|
||||
source_pixmap_priv,
|
||||
mask_pixmap_priv,
|
||||
dest_pixmap_priv,
|
||||
source_pixmap,
|
||||
mask_pixmap,
|
||||
dest_pixmap,
|
||||
®ion, force_clip,
|
||||
x_source, y_source,
|
||||
x_mask, y_mask,
|
||||
|
@ -1688,9 +1657,9 @@ _glamor_composite(CARD8 op,
|
|||
else
|
||||
ok = glamor_composite_clipped_region(op, source,
|
||||
mask, dest,
|
||||
source_pixmap_priv,
|
||||
mask_pixmap_priv,
|
||||
dest_pixmap_priv,
|
||||
source_pixmap,
|
||||
mask_pixmap,
|
||||
dest_pixmap,
|
||||
®ion,
|
||||
x_source, y_source,
|
||||
x_mask, y_mask, x_dest, y_dest);
|
||||
|
@ -1698,17 +1667,9 @@ _glamor_composite(CARD8 op,
|
|||
REGION_UNINIT(dest->pDrawable->pScreen, ®ion);
|
||||
|
||||
if (ok)
|
||||
goto done;
|
||||
fail:
|
||||
return;
|
||||
|
||||
if (!fallback && glamor_ddx_fallback_check_pixmap(&dest_pixmap->drawable)
|
||||
&& (!source_pixmap
|
||||
|| glamor_ddx_fallback_check_pixmap(&source_pixmap->drawable))
|
||||
&& (!mask_pixmap
|
||||
|| glamor_ddx_fallback_check_pixmap(&mask_pixmap->drawable))) {
|
||||
ret = FALSE;
|
||||
goto done;
|
||||
}
|
||||
fail:
|
||||
|
||||
glamor_fallback
|
||||
("from picts %p:%p %dx%d / %p:%p %d x %d (%c,%c) to pict %p:%p %dx%d (%c)\n",
|
||||
|
@ -1739,40 +1700,6 @@ _glamor_composite(CARD8 op,
|
|||
glamor_finish_access_picture(mask);
|
||||
glamor_finish_access_picture(source);
|
||||
glamor_finish_access_picture(dest);
|
||||
|
||||
done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
glamor_composite(CARD8 op,
|
||||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
INT16 x_source,
|
||||
INT16 y_source,
|
||||
INT16 x_mask,
|
||||
INT16 y_mask,
|
||||
INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
|
||||
{
|
||||
_glamor_composite(op, source, mask, dest, x_source, y_source,
|
||||
x_mask, y_mask, x_dest, y_dest, width, height, TRUE);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_composite_nf(CARD8 op,
|
||||
PicturePtr source,
|
||||
PicturePtr mask,
|
||||
PicturePtr dest,
|
||||
INT16 x_source,
|
||||
INT16 y_source,
|
||||
INT16 x_mask,
|
||||
INT16 y_mask,
|
||||
INT16 x_dest, INT16 y_dest, CARD16 width, CARD16 height)
|
||||
{
|
||||
return _glamor_composite(op, source, mask, dest, x_source, y_source,
|
||||
x_mask, y_mask, x_dest, y_dest, width, height,
|
||||
FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1823,21 +1750,27 @@ glamor_composite_glyph_rects(CARD8 op,
|
|||
if (!(glamor_is_large_picture(src)
|
||||
|| (mask && glamor_is_large_picture(mask))
|
||||
|| glamor_is_large_picture(dst))) {
|
||||
PixmapPtr src_pixmap = NULL;
|
||||
PixmapPtr mask_pixmap = NULL;
|
||||
PixmapPtr dst_pixmap = NULL;
|
||||
PixmapPtr temp_src_pixmap = NULL;
|
||||
glamor_pixmap_private *src_pixmap_priv = NULL;
|
||||
glamor_pixmap_private *mask_pixmap_priv = NULL;
|
||||
glamor_pixmap_private *dst_pixmap_priv;
|
||||
glamor_pixmap_private *temp_src_priv = NULL;
|
||||
BoxRec src_extent;
|
||||
|
||||
dst_pixmap_priv = glamor_get_pixmap_private
|
||||
(glamor_get_drawable_pixmap(dst->pDrawable));
|
||||
dst_pixmap = glamor_get_drawable_pixmap(dst->pDrawable);
|
||||
dst_pixmap_priv = glamor_get_pixmap_private(dst_pixmap);
|
||||
|
||||
if (mask && mask->pDrawable)
|
||||
mask_pixmap_priv = glamor_get_pixmap_private
|
||||
(glamor_get_drawable_pixmap(mask->pDrawable));
|
||||
if (src->pDrawable)
|
||||
src_pixmap_priv = glamor_get_pixmap_private
|
||||
(glamor_get_drawable_pixmap(src->pDrawable));
|
||||
if (mask && mask->pDrawable) {
|
||||
mask_pixmap = glamor_get_drawable_pixmap(mask->pDrawable);
|
||||
mask_pixmap_priv = glamor_get_pixmap_private(mask_pixmap);
|
||||
}
|
||||
if (src->pDrawable) {
|
||||
src_pixmap = glamor_get_drawable_pixmap(src->pDrawable);
|
||||
src_pixmap_priv = glamor_get_pixmap_private(src_pixmap);
|
||||
}
|
||||
|
||||
if (!src->pDrawable
|
||||
&& (src->pSourcePict->type != SourcePictTypeSolidFill)) {
|
||||
|
@ -1853,13 +1786,14 @@ glamor_composite_glyph_rects(CARD8 op,
|
|||
if (!temp_src)
|
||||
goto fallback;
|
||||
|
||||
temp_src_priv = glamor_get_pixmap_private
|
||||
((PixmapPtr) (temp_src->pDrawable));
|
||||
temp_src_pixmap = (PixmapPtr) (temp_src->pDrawable);
|
||||
temp_src_priv = glamor_get_pixmap_private(temp_src_pixmap);
|
||||
glamor_composite_src_rect_translate(nrect, rects,
|
||||
-src_extent.x1, -src_extent.y1);
|
||||
}
|
||||
else {
|
||||
temp_src = src;
|
||||
temp_src_pixmap = src_pixmap;
|
||||
temp_src_priv = src_pixmap_priv;
|
||||
}
|
||||
|
||||
|
@ -1867,6 +1801,7 @@ glamor_composite_glyph_rects(CARD8 op,
|
|||
if (op == PictOpOver) {
|
||||
if (glamor_composite_with_shader(PictOpOutReverse,
|
||||
temp_src, mask, dst,
|
||||
temp_src_pixmap, mask_pixmap, dst_pixmap,
|
||||
temp_src_priv,
|
||||
mask_pixmap_priv,
|
||||
dst_pixmap_priv, nrect, rects,
|
||||
|
@ -1876,7 +1811,9 @@ glamor_composite_glyph_rects(CARD8 op,
|
|||
}
|
||||
else {
|
||||
if (glamor_composite_with_shader
|
||||
(op, temp_src, mask, dst, temp_src_priv, mask_pixmap_priv,
|
||||
(op, temp_src, mask, dst,
|
||||
temp_src_pixmap, mask_pixmap, dst_pixmap,
|
||||
temp_src_priv, mask_pixmap_priv,
|
||||
dst_pixmap_priv, nrect, rects, FALSE))
|
||||
goto done;
|
||||
}
|
||||
|
@ -1900,31 +1837,3 @@ glamor_composite_glyph_rects(CARD8 op,
|
|||
if (temp_src && temp_src != src)
|
||||
FreePicture(temp_src, 0);
|
||||
}
|
||||
|
||||
static Bool
|
||||
_glamor_composite_rects(CARD8 op,
|
||||
PicturePtr pDst,
|
||||
xRenderColor *color,
|
||||
int nRect, xRectangle *rects, Bool fallback)
|
||||
{
|
||||
miCompositeRects(op, pDst, color, nRect, rects);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
glamor_composite_rects(CARD8 op,
|
||||
PicturePtr pDst,
|
||||
xRenderColor *color, int nRect, xRectangle *rects)
|
||||
{
|
||||
_glamor_composite_rects(op, pDst, color, nRect, rects, TRUE);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_composite_rects_nf(CARD8 op,
|
||||
PicturePtr pDst,
|
||||
xRenderColor *color, int nRect, xRectangle *rects)
|
||||
{
|
||||
return _glamor_composite_rects(op, pDst, color, nRect, rects, FALSE);
|
||||
}
|
||||
|
||||
#endif /* RENDER */
|
||||
|
|
|
@ -109,12 +109,10 @@ glamor_poly_segment_solid_gl(DrawablePtr drawable, GCPtr gc,
|
|||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
return TRUE;
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -168,21 +166,3 @@ glamor_poly_segment(DrawablePtr drawable, GCPtr gc,
|
|||
|
||||
glamor_poly_segment_bail(drawable, gc, nseg, segs);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_poly_segment_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int nseg, xSegment *segs)
|
||||
{
|
||||
if (glamor_poly_segment_gl(drawable, gc, nseg, segs))
|
||||
return TRUE;
|
||||
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) &&
|
||||
glamor_ddx_fallback_check_gc(gc))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
glamor_poly_segment_bail(drawable, gc, nseg, segs);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
|||
&glamor_facet_fillspans_130);
|
||||
|
||||
if (!prog)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
/* Set up the vertex buffers for the points */
|
||||
|
||||
|
@ -93,7 +93,7 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
|||
&glamor_facet_fillspans_120);
|
||||
|
||||
if (!prog)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
/* Set up the vertex buffers for the points */
|
||||
|
||||
|
@ -134,27 +134,17 @@ glamor_fill_spans_gl(DrawablePtr drawable,
|
|||
if (glamor_priv->glsl_version >= 130)
|
||||
glDrawArraysInstanced(GL_TRIANGLE_STRIP, 0, 4, n);
|
||||
else {
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
||||
glDrawArrays(GL_QUADS, 0, 4 * n);
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < n; i++) {
|
||||
glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
|
||||
}
|
||||
}
|
||||
glamor_glDrawArrays_GL_QUADS(glamor_priv, nbox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
if (glamor_priv->glsl_version >= 130)
|
||||
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
|
||||
return TRUE;
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -182,21 +172,6 @@ glamor_fill_spans(DrawablePtr drawable,
|
|||
glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_fill_spans_nf(DrawablePtr drawable,
|
||||
GCPtr gc,
|
||||
int n, DDXPointPtr points, int *widths, int sorted)
|
||||
{
|
||||
if (glamor_fill_spans_gl(drawable, gc, n, points, widths, sorted))
|
||||
return TRUE;
|
||||
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
|
||||
return FALSE;
|
||||
|
||||
glamor_fill_spans_bail(drawable, gc, n, points, widths, sorted);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
glamor_get_spans_gl(DrawablePtr drawable, int wmax,
|
||||
DDXPointPtr points, int *widths, int count, char *dst)
|
||||
|
@ -226,7 +201,7 @@ glamor_get_spans_gl(DrawablePtr drawable, int wmax,
|
|||
BoxPtr box = glamor_pixmap_box_at(pixmap_priv, box_x, box_y);
|
||||
glamor_pixmap_fbo *fbo = glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y);
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
|
||||
d = dst;
|
||||
|
@ -282,20 +257,6 @@ glamor_get_spans(DrawablePtr drawable, int wmax,
|
|||
glamor_get_spans_bail(drawable, wmax, points, widths, count, dst);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_get_spans_nf(DrawablePtr drawable, int wmax,
|
||||
DDXPointPtr points, int *widths, int count, char *dst)
|
||||
{
|
||||
if (glamor_get_spans_gl(drawable, wmax, points, widths, count, dst))
|
||||
return TRUE;
|
||||
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable))
|
||||
return FALSE;
|
||||
|
||||
glamor_get_spans_bail(drawable, wmax, points, widths, count, dst);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Bool
|
||||
glamor_set_spans_gl(DrawablePtr drawable, GCPtr gc, char *src,
|
||||
DDXPointPtr points, int *widths, int numPoints, int sorted)
|
||||
|
@ -415,17 +376,3 @@ glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
|
|||
return;
|
||||
glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_set_spans_nf(DrawablePtr drawable, GCPtr gc, char *src,
|
||||
DDXPointPtr points, int *widths, int numPoints, int sorted)
|
||||
{
|
||||
if (glamor_set_spans_gl(drawable, gc, src, points, widths, numPoints, sorted))
|
||||
return TRUE;
|
||||
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
|
||||
return FALSE;
|
||||
|
||||
glamor_set_spans_bail(drawable, gc, src, points, widths, numPoints, sorted);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -94,8 +94,10 @@ glamor_sync_init(ScreenPtr screen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_XSHMFENCE
|
||||
if (!miSyncShmScreenInit(screen))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
screen_funcs = miSyncGetScreenFuncs(screen);
|
||||
glamor->saved_procs.sync_screen_funcs.CreateFence = screen_funcs->CreateFence;
|
||||
|
|
|
@ -210,7 +210,6 @@ glamor_text(DrawablePtr drawable, GCPtr gc,
|
|||
glDisableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
|
||||
glVertexAttribDivisor(GLAMOR_VERTEX_POS, 0);
|
||||
glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
|
||||
return x;
|
||||
}
|
||||
|
@ -286,34 +285,18 @@ glamor_poly_text(DrawablePtr drawable, GCPtr gc,
|
|||
prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_text_progs, &glamor_facet_poly_text);
|
||||
|
||||
if (!prog)
|
||||
goto bail_ctx;
|
||||
goto bail;
|
||||
|
||||
x = glamor_text(drawable, gc, glamor_font, prog,
|
||||
x, y, count, chars, charinfo, sixteen);
|
||||
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
|
||||
*final_pos = x;
|
||||
return TRUE;
|
||||
|
||||
bail_ctx:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
bail:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_poly_text8_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, char *chars, int *final_pos)
|
||||
{
|
||||
if (glamor_poly_text(drawable, gc, x, y, count, chars, FALSE, final_pos))
|
||||
return TRUE;
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
|
||||
return FALSE;
|
||||
*final_pos = miPolyText8(drawable, gc, x, y, count, chars);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
glamor_poly_text8(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, char *chars)
|
||||
|
@ -325,19 +308,6 @@ glamor_poly_text8(DrawablePtr drawable, GCPtr gc,
|
|||
return miPolyText8(drawable, gc, x, y, count, chars);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_poly_text16_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, unsigned short *chars, int *final_pos)
|
||||
{
|
||||
if (glamor_poly_text(drawable, gc, x, y, count, (char *) chars, TRUE, final_pos))
|
||||
return TRUE;
|
||||
|
||||
if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
|
||||
return FALSE;
|
||||
*final_pos = miPolyText16(drawable, gc, x, y, count, chars);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
glamor_poly_text16(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, unsigned short *chars)
|
||||
|
@ -493,17 +463,9 @@ glamor_image_text(DrawablePtr drawable, GCPtr gc,
|
|||
return TRUE;
|
||||
|
||||
bail:
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_image_text8_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, char *chars)
|
||||
{
|
||||
return glamor_image_text(drawable, gc, x, y, count, chars, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
glamor_image_text8(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, char *chars)
|
||||
|
@ -512,13 +474,6 @@ glamor_image_text8(DrawablePtr drawable, GCPtr gc,
|
|||
miImageText8(drawable, gc, x, y, count, chars);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_image_text16_nf(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, unsigned short *chars)
|
||||
{
|
||||
return glamor_image_text(drawable, gc, x, y, count, (char *) chars, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
glamor_image_text16(DrawablePtr drawable, GCPtr gc,
|
||||
int x, int y, int count, unsigned short *chars)
|
||||
|
|
|
@ -73,6 +73,8 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
|||
glamor_make_current(glamor_priv);
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
if (glamor_priv->has_unpack_subimage)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
|
||||
|
||||
glamor_pixmap_loop(priv, box_x, box_y) {
|
||||
|
@ -92,25 +94,34 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
|||
int y1 = MAX(boxes->y1 + dy_dst, box->y1);
|
||||
int y2 = MIN(boxes->y2 + dy_dst, box->y2);
|
||||
|
||||
size_t ofs = (y1 - dy_dst + dy_src) * byte_stride;
|
||||
ofs += (x1 - dx_dst + dx_src) * bytes_per_pixel;
|
||||
|
||||
boxes++;
|
||||
|
||||
if (x2 <= x1 || y2 <= y1)
|
||||
continue;
|
||||
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, y1 - dy_dst + dy_src);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, x1 - dx_dst + dx_src);
|
||||
|
||||
if (glamor_priv->has_unpack_subimage ||
|
||||
x2 - x1 == byte_stride / bytes_per_pixel) {
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0,
|
||||
x1 - box->x1, y1 - box->y1,
|
||||
x2 - x1, y2 - y1,
|
||||
format, type,
|
||||
bits);
|
||||
bits + ofs);
|
||||
} else {
|
||||
for (; y1 < y2; y1++, ofs += byte_stride)
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0,
|
||||
x1 - box->x1, y1 - box->y1,
|
||||
x2 - x1, 1,
|
||||
format, type,
|
||||
bits + ofs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (glamor_priv->has_unpack_subimage)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -166,6 +177,7 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
|||
glamor_make_current(glamor_priv);
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 4);
|
||||
if (glamor_priv->has_pack_subimage)
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, byte_stride / bytes_per_pixel);
|
||||
|
||||
glamor_pixmap_loop(priv, box_x, box_y) {
|
||||
|
@ -174,7 +186,7 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
|||
BoxPtr boxes = in_boxes;
|
||||
int nbox = in_nbox;
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->fb);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo->fb);
|
||||
|
||||
while (nbox--) {
|
||||
|
||||
|
@ -183,20 +195,25 @@ glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
|||
int x2 = MIN(boxes->x2 + dx_src, box->x2);
|
||||
int y1 = MAX(boxes->y1 + dy_src, box->y1);
|
||||
int y2 = MIN(boxes->y2 + dy_src, box->y2);
|
||||
size_t ofs = (y1 - dy_src + dy_dst) * byte_stride;
|
||||
ofs += (x1 - dx_src + dx_dst) * bytes_per_pixel;
|
||||
|
||||
boxes++;
|
||||
|
||||
if (x2 <= x1 || y2 <= y1)
|
||||
continue;
|
||||
|
||||
glPixelStorei(GL_PACK_SKIP_PIXELS, x1 - dx_src + dx_dst);
|
||||
glPixelStorei(GL_PACK_SKIP_ROWS, y1 - dy_src + dy_dst);
|
||||
glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits);
|
||||
if (glamor_priv->has_pack_subimage ||
|
||||
x2 - x1 == byte_stride / bytes_per_pixel) {
|
||||
glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, y2 - y1, format, type, bits + ofs);
|
||||
} else {
|
||||
for (; y1 < y2; y1++, ofs += byte_stride)
|
||||
glReadPixels(x1 - box->x1, y1 - box->y1, x2 - x1, 1, format, type, bits + ofs);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (glamor_priv->has_pack_subimage)
|
||||
glPixelStorei(GL_PACK_ROW_LENGTH, 0);
|
||||
glPixelStorei(GL_PACK_SKIP_ROWS, 0);
|
||||
glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -43,6 +43,8 @@ glamor_set_destination_drawable(DrawablePtr drawable,
|
|||
int *p_off_x,
|
||||
int *p_off_y)
|
||||
{
|
||||
ScreenPtr screen = drawable->pScreen;
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
|
||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
int off_x, off_y;
|
||||
|
@ -95,7 +97,7 @@ glamor_set_destination_drawable(DrawablePtr drawable,
|
|||
scale_x, (off_x + center_adjust) * scale_x - 1.0f,
|
||||
scale_y, (off_y + center_adjust) * scale_y - 1.0f);
|
||||
|
||||
glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y),
|
||||
glamor_set_destination_pixmap_fbo(glamor_priv, glamor_pixmap_fbo_at(pixmap_priv, box_x, box_y),
|
||||
0, 0, w, h);
|
||||
}
|
||||
|
||||
|
@ -158,7 +160,7 @@ glamor_set_texture(PixmapPtr pixmap,
|
|||
int off_x,
|
||||
int off_y,
|
||||
GLint offset_uniform,
|
||||
GLint size_uniform)
|
||||
GLint size_inv_uniform)
|
||||
{
|
||||
glamor_pixmap_private *texture_priv;
|
||||
|
||||
|
@ -167,14 +169,14 @@ glamor_set_texture(PixmapPtr pixmap,
|
|||
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(texture_priv))
|
||||
return FALSE;
|
||||
|
||||
if (texture_priv->type == GLAMOR_TEXTURE_LARGE)
|
||||
if (glamor_pixmap_priv_is_large(texture_priv))
|
||||
return FALSE;
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, texture_priv->base.fbo->tex);
|
||||
glBindTexture(GL_TEXTURE_2D, texture_priv->fbo->tex);
|
||||
|
||||
glUniform2f(offset_uniform, off_x, off_y);
|
||||
glUniform2f(size_uniform, texture->drawable.width, texture->drawable.height);
|
||||
glUniform2f(size_inv_uniform, 1.0f/texture->drawable.width, 1.0f/texture->drawable.height);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -182,7 +184,7 @@ Bool
|
|||
glamor_set_tiled(PixmapPtr pixmap,
|
||||
GCPtr gc,
|
||||
GLint offset_uniform,
|
||||
GLint size_uniform)
|
||||
GLint size_inv_uniform)
|
||||
{
|
||||
if (!glamor_set_alu(pixmap->drawable.pScreen, gc->alu))
|
||||
return FALSE;
|
||||
|
@ -195,7 +197,7 @@ glamor_set_tiled(PixmapPtr pixmap,
|
|||
-gc->patOrg.x,
|
||||
-gc->patOrg.y,
|
||||
offset_uniform,
|
||||
size_uniform);
|
||||
size_inv_uniform);
|
||||
}
|
||||
|
||||
static PixmapPtr
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "glamor_priv.h"
|
||||
|
||||
#ifdef RENDER
|
||||
#include "mipict.h"
|
||||
#include "fbpict.h"
|
||||
|
||||
|
@ -155,18 +154,3 @@ glamor_trapezoids(CARD8 op,
|
|||
|
||||
FreePicture(picture, 0);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_trapezoids_nf(CARD8 op,
|
||||
PicturePtr src, PicturePtr dst,
|
||||
PictFormatPtr mask_format, INT16 x_src, INT16 y_src,
|
||||
int ntrap, xTrapezoid *traps)
|
||||
{
|
||||
DEBUGF("x_src = %d, y_src = %d, ntrap = %d\n", x_src, y_src, ntrap);
|
||||
|
||||
glamor_trapezoids(op, src, dst, mask_format, x_src,
|
||||
y_src, ntrap, traps);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif /* RENDER */
|
||||
|
|
|
@ -28,29 +28,6 @@
|
|||
|
||||
#include "glamor_priv.h"
|
||||
|
||||
static Bool
|
||||
_glamor_triangles(CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pDst,
|
||||
PictFormatPtr maskFormat,
|
||||
INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris,
|
||||
Bool fallback)
|
||||
{
|
||||
if (!fallback && glamor_ddx_fallback_check_pixmap(pDst->pDrawable)
|
||||
&& (!pSrc->pDrawable
|
||||
|| glamor_ddx_fallback_check_pixmap(pSrc->pDrawable)))
|
||||
return FALSE;
|
||||
|
||||
if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW) &&
|
||||
glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) {
|
||||
fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris);
|
||||
}
|
||||
glamor_finish_access_picture(pSrc);
|
||||
glamor_finish_access_picture(pDst);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
glamor_triangles(CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
|
@ -58,17 +35,10 @@ glamor_triangles(CARD8 op,
|
|||
PictFormatPtr maskFormat,
|
||||
INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
|
||||
{
|
||||
_glamor_triangles(op, pSrc, pDst, maskFormat,
|
||||
xSrc, ySrc, ntris, tris, TRUE);
|
||||
}
|
||||
|
||||
Bool
|
||||
glamor_triangles_nf(CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pDst,
|
||||
PictFormatPtr maskFormat,
|
||||
INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
|
||||
{
|
||||
return _glamor_triangles(op, pSrc, pDst, maskFormat,
|
||||
xSrc, ySrc, ntris, tris, FALSE);
|
||||
if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW) &&
|
||||
glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) {
|
||||
fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris);
|
||||
}
|
||||
glamor_finish_access_picture(pSrc);
|
||||
glamor_finish_access_picture(pDst);
|
||||
}
|
||||
|
|
|
@ -41,50 +41,46 @@
|
|||
#define t_from_x_coord_y(_yscale_, _y_) (1.0 - (_y_) * (_yscale_))
|
||||
#define t_from_x_coord_y_inverted(_yscale_, _y_) ((_y_) * (_yscale_))
|
||||
|
||||
#define pixmap_priv_get_dest_scale(_pixmap_priv_, _pxscale_, _pyscale_) \
|
||||
#define pixmap_priv_get_dest_scale(pixmap, _pixmap_priv_, _pxscale_, _pyscale_) \
|
||||
do { \
|
||||
int _w_,_h_; \
|
||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(_pixmap_priv_, _w_, _h_); \
|
||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, _pixmap_priv_, _w_, _h_); \
|
||||
*(_pxscale_) = 1.0 / _w_; \
|
||||
*(_pyscale_) = 1.0 / _h_; \
|
||||
} while(0)
|
||||
|
||||
#define pixmap_priv_get_scale(_pixmap_priv_, _pxscale_, _pyscale_) \
|
||||
do { \
|
||||
*(_pxscale_) = 1.0 / (_pixmap_priv_)->base.fbo->width; \
|
||||
*(_pyscale_) = 1.0 / (_pixmap_priv_)->base.fbo->height; \
|
||||
*(_pxscale_) = 1.0 / (_pixmap_priv_)->fbo->width; \
|
||||
*(_pyscale_) = 1.0 / (_pixmap_priv_)->fbo->height; \
|
||||
} while(0)
|
||||
|
||||
#define GLAMOR_PIXMAP_FBO_NOT_EXACT_SIZE(priv) \
|
||||
(priv->base.fbo->width != priv->base.pixmap->drawable.width \
|
||||
|| priv->base.fbo->height != priv->base.pixmap->drawable.height) \
|
||||
|
||||
#define PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, w, h) \
|
||||
#define PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, w, h) \
|
||||
do { \
|
||||
if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
|
||||
w = priv->large.box.x2 - priv->large.box.x1; \
|
||||
h = priv->large.box.y2 - priv->large.box.y1; \
|
||||
if (_X_UNLIKELY(glamor_pixmap_priv_is_large(priv))) { \
|
||||
w = priv->box.x2 - priv->box.x1; \
|
||||
h = priv->box.y2 - priv->box.y1; \
|
||||
} else { \
|
||||
w = priv->base.pixmap->drawable.width; \
|
||||
h = priv->base.pixmap->drawable.height; \
|
||||
w = (pixmap)->drawable.width; \
|
||||
h = (pixmap)->drawable.height; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define glamor_pixmap_fbo_fix_wh_ratio(wh, priv) \
|
||||
#define glamor_pixmap_fbo_fix_wh_ratio(wh, pixmap, priv) \
|
||||
do { \
|
||||
int actual_w, actual_h; \
|
||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(priv, actual_w, actual_h); \
|
||||
wh[0] = (float)priv->base.fbo->width / actual_w; \
|
||||
wh[1] = (float)priv->base.fbo->height / actual_h; \
|
||||
wh[2] = 1.0 / priv->base.fbo->width; \
|
||||
wh[3] = 1.0 / priv->base.fbo->height; \
|
||||
PIXMAP_PRIV_GET_ACTUAL_SIZE(pixmap, priv, actual_w, actual_h); \
|
||||
wh[0] = (float)priv->fbo->width / actual_w; \
|
||||
wh[1] = (float)priv->fbo->height / actual_h; \
|
||||
wh[2] = 1.0 / priv->fbo->width; \
|
||||
wh[3] = 1.0 / priv->fbo->height; \
|
||||
} while(0)
|
||||
|
||||
#define pixmap_priv_get_fbo_off(_priv_, _xoff_, _yoff_) \
|
||||
do { \
|
||||
if (_X_UNLIKELY(_priv_ && (_priv_)->type == GLAMOR_TEXTURE_LARGE)) { \
|
||||
*(_xoff_) = - (_priv_)->large.box.x1; \
|
||||
*(_yoff_) = - (_priv_)->large.box.y1; \
|
||||
if (_X_UNLIKELY(_priv_ && glamor_pixmap_priv_is_large(_priv_))) { \
|
||||
*(_xoff_) = - (_priv_)->box.x1; \
|
||||
*(_yoff_) = - (_priv_)->box.y1; \
|
||||
} else { \
|
||||
*(_xoff_) = 0; \
|
||||
*(_yoff_) = 0; \
|
||||
|
@ -193,33 +189,33 @@
|
|||
txy = xy - bxy1; \
|
||||
} while(0)
|
||||
|
||||
#define _glamor_get_reflect_transform_coords(priv, repeat_type, \
|
||||
#define _glamor_get_reflect_transform_coords(pixmap, priv, repeat_type, \
|
||||
tx1, ty1, \
|
||||
_x1_, _y1_) \
|
||||
do { \
|
||||
int odd_x, odd_y; \
|
||||
float c, d; \
|
||||
fodd_repeat_mod(_x1_,priv->box.x2, \
|
||||
priv->base.pixmap->drawable.width, \
|
||||
(pixmap)->drawable.width, \
|
||||
odd_x, c); \
|
||||
fodd_repeat_mod(_y1_, priv->box.y2, \
|
||||
priv->base.pixmap->drawable.height, \
|
||||
(pixmap)->drawable.height, \
|
||||
odd_y, d); \
|
||||
DEBUGF("c %f d %f oddx %d oddy %d \n", \
|
||||
c, d, odd_x, odd_y); \
|
||||
DEBUGF("x2 %d x1 %d fbo->width %d \n", priv->box.x2, \
|
||||
priv->box.x1, priv->base.fbo->width); \
|
||||
priv->box.x1, priv->fbo->width); \
|
||||
DEBUGF("y2 %d y1 %d fbo->height %d \n", priv->box.y2, \
|
||||
priv->box.y1, priv->base.fbo->height); \
|
||||
priv->box.y1, priv->fbo->height); \
|
||||
_glamor_repeat_reflect_fixup(tx1, _x1_, c, odd_x, \
|
||||
priv->base.pixmap->drawable.width, \
|
||||
(pixmap)->drawable.width, \
|
||||
priv->box.x1, priv->box.x2); \
|
||||
_glamor_repeat_reflect_fixup(ty1, _y1_, d, odd_y, \
|
||||
priv->base.pixmap->drawable.height, \
|
||||
(pixmap)->drawable.height, \
|
||||
priv->box.y1, priv->box.y2); \
|
||||
} while(0)
|
||||
|
||||
#define _glamor_get_repeat_coords(priv, repeat_type, tx1, \
|
||||
#define _glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, \
|
||||
ty1, tx2, ty2, \
|
||||
_x1_, _y1_, _x2_, \
|
||||
_y2_, c, d, odd_x, odd_y) \
|
||||
|
@ -228,10 +224,10 @@
|
|||
DEBUGF("x1 y1 %d %d\n", \
|
||||
_x1_, _y1_ ); \
|
||||
DEBUGF("width %d box.x1 %d \n", \
|
||||
(priv)->base.pixmap->drawable.width, \
|
||||
(pixmap)->drawable.width, \
|
||||
priv->box.x1); \
|
||||
if (odd_x) { \
|
||||
c = (priv)->base.pixmap->drawable.width \
|
||||
c = (pixmap)->drawable.width \
|
||||
- c; \
|
||||
tx1 = c - priv->box.x1; \
|
||||
tx2 = tx1 - ((_x2_) - (_x1_)); \
|
||||
|
@ -240,7 +236,7 @@
|
|||
tx2 = tx1 + ((_x2_) - (_x1_)); \
|
||||
} \
|
||||
if (odd_y){ \
|
||||
d = (priv)->base.pixmap->drawable.height\
|
||||
d = (pixmap)->drawable.height\
|
||||
- d; \
|
||||
ty1 = d - priv->box.y1; \
|
||||
ty2 = ty1 - ((_y2_) - (_y1_)); \
|
||||
|
@ -257,11 +253,11 @@
|
|||
} while(0)
|
||||
|
||||
/* _x1_ ... _y2_ may has fractional. */
|
||||
#define glamor_get_repeat_transform_coords(priv, repeat_type, tx1, \
|
||||
#define glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, tx1, \
|
||||
ty1, _x1_, _y1_) \
|
||||
do { \
|
||||
DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \
|
||||
(priv)->base.pixmap->drawable.width, \
|
||||
(pixmap)->drawable.width, \
|
||||
priv->box.x1, priv->box.x2, priv->box.y1, \
|
||||
priv->box.y2); \
|
||||
DEBUGF("x1 %f y1 %f \n", _x1_, _y1_); \
|
||||
|
@ -269,33 +265,33 @@
|
|||
tx1 = _x1_ - priv->box.x1; \
|
||||
ty1 = _y1_ - priv->box.y1; \
|
||||
} else \
|
||||
_glamor_get_reflect_transform_coords(priv, repeat_type, \
|
||||
_glamor_get_reflect_transform_coords(pixmap, priv, repeat_type, \
|
||||
tx1, ty1, \
|
||||
_x1_, _y1_); \
|
||||
DEBUGF("tx1 %f ty1 %f \n", tx1, ty1); \
|
||||
} while(0)
|
||||
|
||||
/* _x1_ ... _y2_ must be integer. */
|
||||
#define glamor_get_repeat_coords(priv, repeat_type, tx1, \
|
||||
#define glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, \
|
||||
ty1, tx2, ty2, _x1_, _y1_, _x2_, \
|
||||
_y2_) \
|
||||
do { \
|
||||
int c, d; \
|
||||
int odd_x = 0, odd_y = 0; \
|
||||
DEBUGF("width %d box.x1 %d x2 %d y1 %d y2 %d\n", \
|
||||
(priv)->base.pixmap->drawable.width, \
|
||||
(pixmap)->drawable.width, \
|
||||
priv->box.x1, priv->box.x2, \
|
||||
priv->box.y1, priv->box.y2); \
|
||||
modulus((_x1_), (priv)->base.pixmap->drawable.width, c); \
|
||||
modulus((_y1_), (priv)->base.pixmap->drawable.height, d); \
|
||||
modulus((_x1_), (pixmap)->drawable.width, c); \
|
||||
modulus((_y1_), (pixmap)->drawable.height, d); \
|
||||
DEBUGF("c %d d %d \n", c, d); \
|
||||
if (repeat_type == RepeatReflect) { \
|
||||
odd_x = abs((_x1_ - c) \
|
||||
/ (priv->base.pixmap->drawable.width)) & 1; \
|
||||
/ ((pixmap)->drawable.width)) & 1; \
|
||||
odd_y = abs((_y1_ - d) \
|
||||
/ (priv->base.pixmap->drawable.height)) & 1; \
|
||||
/ ((pixmap)->drawable.height)) & 1; \
|
||||
} \
|
||||
_glamor_get_repeat_coords(priv, repeat_type, tx1, ty1, tx2, ty2,\
|
||||
_glamor_get_repeat_coords(pixmap, priv, repeat_type, tx1, ty1, tx2, ty2, \
|
||||
_x1_, _y1_, _x2_, _y2_, c, d, \
|
||||
odd_x, odd_y); \
|
||||
} while(0)
|
||||
|
@ -404,7 +400,7 @@
|
|||
texcoords+4); \
|
||||
} while (0)
|
||||
|
||||
#define glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \
|
||||
#define glamor_set_repeat_transformed_normalize_tcoords_ext(pixmap, priv, \
|
||||
repeat_type, \
|
||||
matrix, \
|
||||
xscale, \
|
||||
|
@ -414,7 +410,7 @@
|
|||
texcoords, \
|
||||
stride) \
|
||||
do { \
|
||||
if (_X_LIKELY(priv->type != GLAMOR_TEXTURE_LARGE)) { \
|
||||
if (_X_LIKELY(glamor_pixmap_priv_is_small(priv))) { \
|
||||
glamor_set_transformed_normalize_tcoords_ext(priv, matrix, xscale, \
|
||||
yscale, _x1_, _y1_, \
|
||||
_x2_, _y2_, \
|
||||
|
@ -429,16 +425,16 @@
|
|||
glamor_transform_point(matrix, tx4, ty4, _x1_, _y2_); \
|
||||
DEBUGF("transformed %f %f %f %f %f %f %f %f\n", \
|
||||
tx1, ty1, tx2, ty2, tx3, ty3, tx4, ty4); \
|
||||
glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
|
||||
glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
|
||||
ttx1, tty1, \
|
||||
tx1, ty1); \
|
||||
glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
|
||||
glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
|
||||
ttx2, tty2, \
|
||||
tx2, ty2); \
|
||||
glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
|
||||
glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
|
||||
ttx3, tty3, \
|
||||
tx3, ty3); \
|
||||
glamor_get_repeat_transform_coords((&priv->large), repeat_type, \
|
||||
glamor_get_repeat_transform_coords(pixmap, priv, repeat_type, \
|
||||
ttx4, tty4, \
|
||||
tx4, ty4); \
|
||||
DEBUGF("repeat transformed %f %f %f %f %f %f %f %f\n", ttx1, tty1, \
|
||||
|
@ -454,7 +450,8 @@
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
#define glamor_set_repeat_transformed_normalize_tcoords( priv, \
|
||||
#define glamor_set_repeat_transformed_normalize_tcoords( pixmap, \
|
||||
priv, \
|
||||
repeat_type, \
|
||||
matrix, \
|
||||
xscale, \
|
||||
|
@ -463,7 +460,8 @@
|
|||
_x2_, _y2_, \
|
||||
texcoords) \
|
||||
do { \
|
||||
glamor_set_repeat_transformed_normalize_tcoords_ext( priv, \
|
||||
glamor_set_repeat_transformed_normalize_tcoords_ext( pixmap, \
|
||||
priv, \
|
||||
repeat_type, \
|
||||
matrix, \
|
||||
xscale, \
|
||||
|
@ -495,7 +493,7 @@
|
|||
x1, y1, x2, y2, \
|
||||
vertices, stride) \
|
||||
do { \
|
||||
if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
|
||||
if (_X_UNLIKELY(glamor_pixmap_priv_is_large(priv))) { \
|
||||
float tx1, tx2, ty1, ty2; \
|
||||
int fbo_x_off, fbo_y_off; \
|
||||
pixmap_priv_get_fbo_off(priv, &fbo_x_off, &fbo_y_off); \
|
||||
|
@ -520,20 +518,20 @@
|
|||
vertices, 2); \
|
||||
} while(0)
|
||||
|
||||
#define glamor_set_repeat_normalize_tcoords_ext(priv, repeat_type, \
|
||||
#define glamor_set_repeat_normalize_tcoords_ext(pixmap, priv, repeat_type, \
|
||||
xscale, yscale, \
|
||||
_x1_, _y1_, _x2_, _y2_, \
|
||||
vertices, stride) \
|
||||
do { \
|
||||
if (_X_UNLIKELY(priv->type == GLAMOR_TEXTURE_LARGE)) { \
|
||||
if (_X_UNLIKELY(glamor_pixmap_priv_is_large(priv))) { \
|
||||
float tx1, tx2, ty1, ty2; \
|
||||
if (repeat_type == RepeatPad) { \
|
||||
tx1 = _x1_ - priv->large.box.x1; \
|
||||
ty1 = _y1_ - priv->large.box.y1; \
|
||||
tx1 = _x1_ - priv->box.x1; \
|
||||
ty1 = _y1_ - priv->box.y1; \
|
||||
tx2 = tx1 + ((_x2_) - (_x1_)); \
|
||||
ty2 = ty1 + ((_y2_) - (_y1_)); \
|
||||
} else { \
|
||||
glamor_get_repeat_coords((&priv->large), repeat_type, \
|
||||
glamor_get_repeat_coords(pixmap, priv, repeat_type, \
|
||||
tx1, ty1, tx2, ty2, \
|
||||
_x1_, _y1_, _x2_, _y2_); \
|
||||
} \
|
||||
|
@ -758,9 +756,9 @@ glamor_translate_boxes(BoxPtr boxes, int nbox, int dx, int dy)
|
|||
|| _depth_ == 30 \
|
||||
|| _depth_ == 32)
|
||||
|
||||
#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->base.is_picture == 1)
|
||||
#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->base.gl_fbo == GLAMOR_FBO_NORMAL)
|
||||
#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->base.gl_fbo == GLAMOR_FBO_DOWNLOADED))
|
||||
#define GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) (pixmap_priv && pixmap_priv->is_picture == 1)
|
||||
#define GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv) (pixmap_priv && pixmap_priv->gl_fbo == GLAMOR_FBO_NORMAL)
|
||||
#define GLAMOR_PIXMAP_PRIV_HAS_FBO_DOWNLOADED(pixmap_priv) (pixmap_priv && (pixmap_priv->gl_fbo == GLAMOR_FBO_DOWNLOADED))
|
||||
|
||||
/**
|
||||
* Borrow from uxa.
|
||||
|
@ -795,10 +793,10 @@ static inline GLenum
|
|||
gl_iformat_for_pixmap(PixmapPtr pixmap)
|
||||
{
|
||||
glamor_screen_private *glamor_priv =
|
||||
glamor_get_screen_private(pixmap->drawable.pScreen);
|
||||
glamor_get_screen_private((pixmap)->drawable.pScreen);
|
||||
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP &&
|
||||
(pixmap->drawable.depth == 1 || pixmap->drawable.depth == 8)) {
|
||||
((pixmap)->drawable.depth == 1 || (pixmap)->drawable.depth == 8)) {
|
||||
return GL_ALPHA;
|
||||
} else {
|
||||
return GL_RGBA;
|
||||
|
@ -813,9 +811,9 @@ format_for_pixmap(PixmapPtr pixmap)
|
|||
|
||||
pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv))
|
||||
pict_format = pixmap_priv->base.picture->format;
|
||||
pict_format = pixmap_priv->picture->format;
|
||||
else
|
||||
pict_format = format_for_depth(pixmap->drawable.depth);
|
||||
pict_format = format_for_depth((pixmap)->drawable.depth);
|
||||
|
||||
return pict_format;
|
||||
}
|
||||
|
@ -939,47 +937,13 @@ glamor_pict_format_is_compatible(PicturePtr picture)
|
|||
}
|
||||
}
|
||||
|
||||
/* return TRUE if we can access this pixmap at DDX driver. */
|
||||
inline static Bool
|
||||
glamor_ddx_fallback_check_pixmap(DrawablePtr drawable)
|
||||
{
|
||||
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
|
||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
|
||||
return (!pixmap_priv
|
||||
|| (pixmap_priv->type == GLAMOR_TEXTURE_DRM
|
||||
|| pixmap_priv->type == GLAMOR_MEMORY
|
||||
|| pixmap_priv->type == GLAMOR_DRM_ONLY));
|
||||
}
|
||||
|
||||
inline static Bool
|
||||
glamor_ddx_fallback_check_gc(GCPtr gc)
|
||||
{
|
||||
PixmapPtr pixmap;
|
||||
|
||||
if (!gc)
|
||||
return TRUE;
|
||||
switch (gc->fillStyle) {
|
||||
case FillStippled:
|
||||
case FillOpaqueStippled:
|
||||
pixmap = gc->stipple;
|
||||
break;
|
||||
case FillTiled:
|
||||
pixmap = gc->tile.pixmap;
|
||||
break;
|
||||
default:
|
||||
pixmap = NULL;
|
||||
}
|
||||
return (!pixmap || glamor_ddx_fallback_check_pixmap(&pixmap->drawable));
|
||||
}
|
||||
|
||||
inline static Bool
|
||||
glamor_is_large_pixmap(PixmapPtr pixmap)
|
||||
{
|
||||
glamor_pixmap_private *priv;
|
||||
|
||||
priv = glamor_get_pixmap_private(pixmap);
|
||||
return (priv->type == GLAMOR_TEXTURE_LARGE);
|
||||
return (glamor_pixmap_priv_is_large(priv));
|
||||
}
|
||||
|
||||
inline static Bool
|
||||
|
@ -1005,8 +969,8 @@ static inline void
|
|||
_glamor_dump_pixmap_bits(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||
{
|
||||
int i, j;
|
||||
unsigned char *p = pixmap->devPrivate.ptr;
|
||||
int stride = pixmap->devKind;
|
||||
unsigned char *p = (pixmap)->devPrivate.ptr;
|
||||
int stride = (pixmap)->devKind;
|
||||
|
||||
p = p + y * stride + x;
|
||||
|
||||
|
@ -1023,8 +987,8 @@ static inline void
|
|||
_glamor_dump_pixmap_byte(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||
{
|
||||
int i, j;
|
||||
unsigned char *p = pixmap->devPrivate.ptr;
|
||||
int stride = pixmap->devKind;
|
||||
unsigned char *p = (pixmap)->devPrivate.ptr;
|
||||
int stride = (pixmap)->devKind;
|
||||
|
||||
p = p + y * stride + x;
|
||||
|
||||
|
@ -1041,8 +1005,8 @@ static inline void
|
|||
_glamor_dump_pixmap_sword(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||
{
|
||||
int i, j;
|
||||
unsigned short *p = pixmap->devPrivate.ptr;
|
||||
int stride = pixmap->devKind / 2;
|
||||
unsigned short *p = (pixmap)->devPrivate.ptr;
|
||||
int stride = (pixmap)->devKind / 2;
|
||||
|
||||
p = p + y * stride + x;
|
||||
|
||||
|
@ -1059,8 +1023,8 @@ static inline void
|
|||
_glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||
{
|
||||
int i, j;
|
||||
unsigned int *p = pixmap->devPrivate.ptr;
|
||||
int stride = pixmap->devKind / 4;
|
||||
unsigned int *p = (pixmap)->devPrivate.ptr;
|
||||
int stride = (pixmap)->devKind / 4;
|
||||
|
||||
p = p + y * stride + x;
|
||||
|
||||
|
@ -1076,11 +1040,11 @@ _glamor_dump_pixmap_word(PixmapPtr pixmap, int x, int y, int w, int h)
|
|||
static inline void
|
||||
glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
|
||||
{
|
||||
w = ((x + w) > pixmap->drawable.width) ? (pixmap->drawable.width - x) : w;
|
||||
h = ((y + h) > pixmap->drawable.height) ? (pixmap->drawable.height - y) : h;
|
||||
w = ((x + w) > (pixmap)->drawable.width) ? ((pixmap)->drawable.width - x) : w;
|
||||
h = ((y + h) > (pixmap)->drawable.height) ? ((pixmap)->drawable.height - y) : h;
|
||||
|
||||
glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
|
||||
switch (pixmap->drawable.depth) {
|
||||
glamor_prepare_access(&(pixmap)->drawable, GLAMOR_ACCESS_RO);
|
||||
switch ((pixmap)->drawable.depth) {
|
||||
case 8:
|
||||
_glamor_dump_pixmap_byte(pixmap, x, y, w, h);
|
||||
break;
|
||||
|
@ -1097,9 +1061,9 @@ glamor_dump_pixmap(PixmapPtr pixmap, int x, int y, int w, int h)
|
|||
_glamor_dump_pixmap_bits(pixmap, x, y, w, h);
|
||||
break;
|
||||
default:
|
||||
ErrorF("dump depth %d, not implemented.\n", pixmap->drawable.depth);
|
||||
ErrorF("dump depth %d, not implemented.\n", (pixmap)->drawable.depth);
|
||||
}
|
||||
glamor_finish_access(&pixmap->drawable);
|
||||
glamor_finish_access(&(pixmap)->drawable);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -1297,7 +1261,7 @@ glamor_compare_pictures(ScreenPtr screen,
|
|||
GLAMOR_CREATE_PIXMAP_CPU);
|
||||
|
||||
pixman_pic = CreatePicture(0,
|
||||
&pixmap->drawable,
|
||||
&(pixmap)->drawable,
|
||||
PictureMatchFormat(screen,
|
||||
PIXMAN_FORMAT_DEPTH
|
||||
(format), format), 0, 0,
|
||||
|
@ -1325,7 +1289,7 @@ glamor_compare_pictures(ScreenPtr screen,
|
|||
GLAMOR_CREATE_PIXMAP_CPU);
|
||||
|
||||
pixman_pic = CreatePicture(0,
|
||||
&pixmap->drawable,
|
||||
&(pixmap)->drawable,
|
||||
PictureMatchFormat(screen,
|
||||
PIXMAN_FORMAT_DEPTH
|
||||
(format), format), 0, 0,
|
||||
|
@ -1429,4 +1393,21 @@ glamor_make_current(glamor_screen_private *glamor_priv)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for implementing draws with GL_QUADS on GLES2,
|
||||
* where we don't have them.
|
||||
*/
|
||||
static inline void
|
||||
glamor_glDrawArrays_GL_QUADS(glamor_screen_private *glamor_priv, unsigned count)
|
||||
{
|
||||
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) {
|
||||
glDrawArrays(GL_QUADS, 0, count * 4);
|
||||
} else {
|
||||
unsigned i;
|
||||
for (i = 0; i < count; i++)
|
||||
glDrawArrays(GL_TRIANGLE_FAN, i * 4, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -79,16 +79,16 @@ glamor_set_window_pixmap(WindowPtr win, PixmapPtr pPixmap)
|
|||
|
||||
pixmap_priv = glamor_get_pixmap_private(old);
|
||||
if (GLAMOR_PIXMAP_PRIV_IS_PICTURE(pixmap_priv) &&
|
||||
pixmap_priv->base.picture->pDrawable == (DrawablePtr) win) {
|
||||
pic = pixmap_priv->base.picture;
|
||||
pixmap_priv->base.is_picture = 0;
|
||||
pixmap_priv->base.picture = NULL;
|
||||
pixmap_priv->picture->pDrawable == (DrawablePtr) win) {
|
||||
pic = pixmap_priv->picture;
|
||||
pixmap_priv->is_picture = 0;
|
||||
pixmap_priv->picture = NULL;
|
||||
}
|
||||
|
||||
pixmap_priv = glamor_get_pixmap_private(pPixmap);
|
||||
if (pixmap_priv) {
|
||||
pixmap_priv->base.is_picture = ! !pic;
|
||||
pixmap_priv->base.picture = pic;
|
||||
pixmap_priv->is_picture = ! !pic;
|
||||
pixmap_priv->picture = pic;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -241,8 +241,8 @@ glamor_xv_render(glamor_port_private *port_priv)
|
|||
{
|
||||
ScreenPtr screen = port_priv->pPixmap->drawable.pScreen;
|
||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
||||
glamor_pixmap_private *pixmap_priv =
|
||||
glamor_get_pixmap_private(port_priv->pPixmap);
|
||||
PixmapPtr pixmap = port_priv->pPixmap;
|
||||
glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
|
||||
glamor_pixmap_private *src_pixmap_priv[3];
|
||||
float vertices[32], texcoords[8];
|
||||
BoxPtr box = REGION_RECTS(&port_priv->clip);
|
||||
|
@ -282,10 +282,11 @@ glamor_xv_render(glamor_port_private *port_priv)
|
|||
off[2] = Loff * yco + Coff * (uco[2] + vco[2]) + bright;
|
||||
gamma = 1.0;
|
||||
|
||||
pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
|
||||
pixmap_priv_get_dest_scale(pixmap, pixmap_priv, &dst_xscale, &dst_yscale);
|
||||
glamor_get_drawable_deltas(port_priv->pDraw, port_priv->pPixmap, &dst_x_off,
|
||||
&dst_y_off);
|
||||
glamor_set_destination_pixmap_priv_nc(pixmap_priv);
|
||||
glamor_set_destination_pixmap_priv_nc(glamor_priv, pixmap, pixmap_priv);
|
||||
glamor_set_alu(screen, GXcopy);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (port_priv->src_pix[i]) {
|
||||
|
@ -306,21 +307,21 @@ glamor_xv_render(glamor_port_private *port_priv)
|
|||
glUniform4f(uloc, vco[0], vco[1], vco[2], 0);
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->base.fbo->tex);
|
||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[0]->fbo->tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->base.fbo->tex);
|
||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[1]->fbo->tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
|
||||
glActiveTexture(GL_TEXTURE2);
|
||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->base.fbo->tex);
|
||||
glBindTexture(GL_TEXTURE_2D, src_pixmap_priv[2]->fbo->tex);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
|
|
|
@ -214,6 +214,8 @@ ephyr_glamor_damage_redisplay(struct ephyr_glamor *glamor,
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
glUseProgram(glamor->texture_shader);
|
||||
glViewport(0, 0, glamor->width, glamor->height);
|
||||
if (!ephyr_glamor_gles2)
|
||||
glDisable(GL_COLOR_LOGIC_OP);
|
||||
|
||||
glVertexAttribPointer(glamor->texture_shader_position_loc,
|
||||
2, GL_FLOAT, FALSE, 0, position);
|
||||
|
|
|
@ -1407,9 +1407,10 @@ ephyr_glamor_init(ScreenPtr screen)
|
|||
ephyr_glamor_set_window_size(scrpriv->glamor,
|
||||
scrpriv->win_width, scrpriv->win_height);
|
||||
|
||||
glamor_init(screen,
|
||||
GLAMOR_USE_SCREEN |
|
||||
GLAMOR_USE_PICTURE_SCREEN);
|
||||
if (!glamor_init(screen, 0)) {
|
||||
FatalError("Failed to initialize glamor\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1049,10 +1049,7 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
|||
|
||||
#ifdef GLAMOR
|
||||
if (ms->drmmode.glamor) {
|
||||
if (!glamor_init(pScreen,
|
||||
GLAMOR_USE_EGL_SCREEN |
|
||||
GLAMOR_USE_SCREEN |
|
||||
GLAMOR_USE_PICTURE_SCREEN)) {
|
||||
if (!glamor_init(pScreen, GLAMOR_USE_EGL_SCREEN)) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"Failed to initialize glamor at ScreenInit() time.\n");
|
||||
return FALSE;
|
||||
|
|
|
@ -43,6 +43,7 @@ xwayland-glamor.c : $(nodist_Xwayland_SOURCES)
|
|||
glamor_lib = $(top_builddir)/glamor/libglamor.la
|
||||
|
||||
Xwayland_LDADD += $(GLAMOR_LIBS) $(GBM_LIBS) -lEGL -lGL
|
||||
Xwayland_DEPENDENCIES = $(glamor_lib)
|
||||
endif
|
||||
|
||||
EXTRA_DIST = drm.xml
|
||||
|
|
|
@ -549,11 +549,7 @@ xwl_glamor_init(struct xwl_screen *xwl_screen)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!glamor_init(xwl_screen->screen,
|
||||
GLAMOR_INVERTED_Y_AXIS |
|
||||
GLAMOR_USE_EGL_SCREEN |
|
||||
GLAMOR_USE_SCREEN |
|
||||
GLAMOR_USE_PICTURE_SCREEN)) {
|
||||
if (!glamor_init(xwl_screen->screen, GLAMOR_USE_EGL_SCREEN)) {
|
||||
ErrorF("Failed to initialize glamor\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user