Commit ace35e40 authored by Zhigang Gong's avatar Zhigang Gong Committed by Eric Anholt

glamor_largepixmap: first commit for large pixmap.

This is the first commit to add support for large pixmap.
The large here means a pixmap is larger than the texutre's
size limitation thus can't fit into one single texutre.

The previous implementation will simply fallback to use a
in memory pixmap to contain the large pixmap which is
very slow in practice.

The basic idea here is to use an array of texture to hold
the large pixmap. And when we need to get a specific area
of the pixmap, we just need to compute/clip the correct
region and find the corresponding fbo.

We need to implement some auxiliary routines to clip every
rendering operations into small pieces which can fit into
one texture.

The complex part is the transformation/repeat/repeatReflect
and repeat pad and their comination. We will support all of
them step by step.

This commit just add some necessary data structure to represent
the large pixmap, and doesn't change any rendering process.
This commit doesn't add real large pixmap support.
Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 4c174f4c
...@@ -73,8 +73,8 @@ glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type) ...@@ -73,8 +73,8 @@ glamor_set_pixmap_type(PixmapPtr pixmap, glamor_pixmap_type_t type)
if (pixmap_priv == NULL) { if (pixmap_priv == NULL) {
pixmap_priv = calloc(sizeof(*pixmap_priv), 1); pixmap_priv = calloc(sizeof(*pixmap_priv), 1);
glamor_set_pixmap_private(pixmap, pixmap_priv); glamor_set_pixmap_private(pixmap, pixmap_priv);
pixmap_priv->container = pixmap; pixmap_priv->base.pixmap = pixmap;
pixmap_priv->glamor_priv = glamor_priv; pixmap_priv->base.glamor_priv = glamor_priv;
} }
pixmap_priv->type = type; pixmap_priv->type = type;
} }
...@@ -91,7 +91,7 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex) ...@@ -91,7 +91,7 @@ glamor_set_pixmap_texture(PixmapPtr pixmap, unsigned int tex)
glamor_priv = glamor_get_screen_private(screen); glamor_priv = glamor_get_screen_private(screen);
pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv->fbo) { if (pixmap_priv->base.fbo) {
fbo = glamor_pixmap_detach_fbo(pixmap_priv); fbo = glamor_pixmap_detach_fbo(pixmap_priv);
glamor_destroy_fbo(fbo); glamor_destroy_fbo(fbo);
} }
...@@ -117,10 +117,10 @@ glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap) ...@@ -117,10 +117,10 @@ glamor_set_screen_pixmap(PixmapPtr screen_pixmap, PixmapPtr *back_pixmap)
glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen); glamor_priv = glamor_get_screen_private(screen_pixmap->drawable.pScreen);
pixmap_priv = glamor_get_pixmap_private(screen_pixmap); pixmap_priv = glamor_get_pixmap_private(screen_pixmap);
glamor_priv->screen_fbo = pixmap_priv->fbo->fb; glamor_priv->screen_fbo = pixmap_priv->base.fbo->fb;
pixmap_priv->fbo->width = screen_pixmap->drawable.width; pixmap_priv->base.fbo->width = screen_pixmap->drawable.width;
pixmap_priv->fbo->height = screen_pixmap->drawable.height; pixmap_priv->base.fbo->height = screen_pixmap->drawable.height;
glamor_priv->back_pixmap = back_pixmap; glamor_priv->back_pixmap = back_pixmap;
} }
...@@ -159,8 +159,8 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, ...@@ -159,8 +159,8 @@ glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
if (usage == GLAMOR_CREATE_PIXMAP_MAP) if (usage == GLAMOR_CREATE_PIXMAP_MAP)
type = GLAMOR_MEMORY_MAP; type = GLAMOR_MEMORY_MAP;
pixmap_priv->container = pixmap; pixmap_priv->base.pixmap = pixmap;
pixmap_priv->glamor_priv = glamor_priv; pixmap_priv->base.glamor_priv = glamor_priv;
pixmap_priv->type = type; pixmap_priv->type = type;
gl_iformat_for_depth(depth, &format); gl_iformat_for_depth(depth, &format);
......
...@@ -55,7 +55,9 @@ typedef enum glamor_pixmap_type { ...@@ -55,7 +55,9 @@ typedef enum glamor_pixmap_type {
GLAMOR_TEXTURE_DRM, GLAMOR_TEXTURE_DRM,
GLAMOR_SEPARATE_TEXTURE, GLAMOR_SEPARATE_TEXTURE,
GLAMOR_DRM_ONLY, GLAMOR_DRM_ONLY,
GLAMOR_TEXTURE_ONLY GLAMOR_TEXTURE_ONLY,
GLAMOR_TEXTURE_LARGE,
GLAMOR_TEXTURE_PACK
} glamor_pixmap_type_t; } glamor_pixmap_type_t;
#define GLAMOR_EGL_EXTERNAL_BUFFER 3 #define GLAMOR_EGL_EXTERNAL_BUFFER 3
......
...@@ -75,7 +75,7 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src, ...@@ -75,7 +75,7 @@ glamor_copy_n_to_n_fbo_blit(DrawablePtr src,
dispatch = glamor_get_dispatch(glamor_priv); dispatch = glamor_get_dispatch(glamor_priv);
dispatch->glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT, dispatch->glBindFramebuffer(GL_READ_FRAMEBUFFER_EXT,
src_pixmap_priv->fbo->fb); src_pixmap_priv->base.fbo->fb);
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off,
&dst_y_off); &dst_y_off);
glamor_get_drawable_deltas(src, src_pixmap, &src_x_off, glamor_get_drawable_deltas(src, src_pixmap, &src_x_off,
...@@ -164,7 +164,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src, ...@@ -164,7 +164,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
return FALSE; return FALSE;
} }
if (!src_pixmap_priv || !src_pixmap_priv->gl_fbo) { if (!src_pixmap_priv || !src_pixmap_priv->base.gl_fbo) {
#ifndef GLAMOR_PIXMAP_DYNAMIC_UPLOAD #ifndef GLAMOR_PIXMAP_DYNAMIC_UPLOAD
glamor_delayed_fallback(dst->pScreen, "src has no fbo.\n"); glamor_delayed_fallback(dst->pScreen, "src has no fbo.\n");
return FALSE; return FALSE;
...@@ -209,7 +209,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src, ...@@ -209,7 +209,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
dispatch->glActiveTexture(GL_TEXTURE0); dispatch->glActiveTexture(GL_TEXTURE0);
dispatch->glBindTexture(GL_TEXTURE_2D, dispatch->glBindTexture(GL_TEXTURE_2D,
src_pixmap_priv->fbo->tex); src_pixmap_priv->base.fbo->tex);
#ifndef GLAMOR_GLES2 #ifndef GLAMOR_GLES2
dispatch->glEnable(GL_TEXTURE_2D); dispatch->glEnable(GL_TEXTURE_2D);
dispatch->glTexParameteri(GL_TEXTURE_2D, dispatch->glTexParameteri(GL_TEXTURE_2D,
...@@ -239,7 +239,8 @@ glamor_copy_n_to_n_textured(DrawablePtr src, ...@@ -239,7 +239,8 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
for (i = 0; i < nbox; i++) { for (i = 0; i < nbox; i++) {
glamor_set_normalize_vcoords(dst_xscale, dst_yscale, glamor_set_normalize_vcoords(dst_pixmap_priv, dst_xscale,
dst_yscale,
box[i].x1 + dst_x_off, box[i].x1 + dst_x_off,
box[i].y1 + dst_y_off, box[i].y1 + dst_y_off,
box[i].x2 + dst_x_off, box[i].x2 + dst_x_off,
...@@ -247,7 +248,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src, ...@@ -247,7 +248,7 @@ glamor_copy_n_to_n_textured(DrawablePtr src,
glamor_priv->yInverted, glamor_priv->yInverted,
vertices); vertices);
glamor_set_normalize_tcoords(src_xscale, glamor_set_normalize_tcoords(src_pixmap_priv, src_xscale,
src_yscale, src_yscale,
box[i].x1 + dx, box[i].x1 + dx,
box[i].y1 + dy, box[i].y1 + dy,
...@@ -320,7 +321,7 @@ _glamor_copy_n_to_n(DrawablePtr src, ...@@ -320,7 +321,7 @@ _glamor_copy_n_to_n(DrawablePtr src,
glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off, glamor_get_drawable_deltas(dst, dst_pixmap, &dst_x_off,
&dst_y_off); &dst_y_off);
if (src_pixmap_priv->fbo && src_pixmap_priv->fbo->fb == dst_pixmap_priv->fbo->fb) { if (src_pixmap_priv->base.fbo && src_pixmap_priv->base.fbo->fb == dst_pixmap_priv->base.fbo->fb) {
int x_shift = abs(src_x_off - dx - dst_x_off); int x_shift = abs(src_x_off - dx - dst_x_off);
int y_shift = abs(src_y_off - dy - dst_y_off); int y_shift = abs(src_y_off - dy - dst_y_off);
for (i = 0; i < nbox; i++) { for (i = 0; i < nbox; i++) {
...@@ -333,7 +334,7 @@ _glamor_copy_n_to_n(DrawablePtr src, ...@@ -333,7 +334,7 @@ _glamor_copy_n_to_n(DrawablePtr src,
} }
#ifndef GLAMOR_GLES2 #ifndef GLAMOR_GLES2
if ((overlaped if ((overlaped
|| !src_pixmap_priv->gl_tex || !dst_pixmap_priv->gl_tex) || !src_pixmap_priv->base.gl_tex || !dst_pixmap_priv->base.gl_tex)
&& glamor_copy_n_to_n_fbo_blit(src, dst, gc, box, nbox, dx, && glamor_copy_n_to_n_fbo_blit(src, dst, gc, box, nbox, dx,
dy)) { dy)) {
ret = TRUE; ret = TRUE;
......
...@@ -43,9 +43,9 @@ glamor_get_drawable_location(const DrawablePtr drawable) ...@@ -43,9 +43,9 @@ glamor_get_drawable_location(const DrawablePtr drawable)
glamor_get_pixmap_private(pixmap); glamor_get_pixmap_private(pixmap);
glamor_screen_private *glamor_priv = glamor_screen_private *glamor_priv =
glamor_get_screen_private(drawable->pScreen); glamor_get_screen_private(drawable->pScreen);
if (pixmap_priv == NULL || pixmap_priv->gl_fbo == 0) if (pixmap_priv == NULL || pixmap_priv->base.gl_fbo == 0)
return 'm'; return 'm';
if (pixmap_priv->fbo->fb == glamor_priv->screen_fbo) if (pixmap_priv->base.fbo->fb == glamor_priv->screen_fbo)
return 's'; return 's';
else else
return 'f'; return 'f';
...@@ -327,7 +327,7 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode) ...@@ -327,7 +327,7 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
glamor_restore_pixmap_to_texture(pixmap); glamor_restore_pixmap_to_texture(pixmap);
} }
if (pixmap_priv->fbo->pbo != 0 && pixmap_priv->fbo->pbo_valid) { if (pixmap_priv->base.fbo->pbo != 0 && pixmap_priv->base.fbo->pbo_valid) {
glamor_gl_dispatch *dispatch; glamor_gl_dispatch *dispatch;
assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP); assert(glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP);
...@@ -335,20 +335,20 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode) ...@@ -335,20 +335,20 @@ glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
dispatch = glamor_get_dispatch(glamor_priv); dispatch = glamor_get_dispatch(glamor_priv);
dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); dispatch->glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0); dispatch->glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
dispatch->glDeleteBuffers(1, &pixmap_priv->fbo->pbo); dispatch->glDeleteBuffers(1, &pixmap_priv->base.fbo->pbo);
glamor_put_dispatch(glamor_priv); glamor_put_dispatch(glamor_priv);
pixmap_priv->fbo->pbo_valid = FALSE; pixmap_priv->base.fbo->pbo_valid = FALSE;
pixmap_priv->fbo->pbo = 0; pixmap_priv->base.fbo->pbo = 0;
} else { } else {
free(pixmap->devPrivate.ptr); free(pixmap->devPrivate.ptr);
} }
if (pixmap_priv->type == GLAMOR_TEXTURE_DRM) if (pixmap_priv->type == GLAMOR_TEXTURE_DRM)
pixmap->devKind = pixmap_priv->drm_stride; pixmap->devKind = pixmap_priv->base.drm_stride;
if (pixmap_priv->gl_fbo == GLAMOR_FBO_DOWNLOADED) if (pixmap_priv->base.gl_fbo == GLAMOR_FBO_DOWNLOADED)
pixmap_priv->gl_fbo = GLAMOR_FBO_NORMAL; pixmap_priv->base.gl_fbo = GLAMOR_FBO_NORMAL;
pixmap->devPrivate.ptr = NULL; pixmap->devPrivate.ptr = NULL;
} }
......
...@@ -107,8 +107,10 @@ AbortServer(void) ...@@ -107,8 +107,10 @@ AbortServer(void)
_glamor_priv_->delayed_fallback_string); \ _glamor_priv_->delayed_fallback_string); \
_glamor_priv_->delayed_fallback_pending = 0; } } while(0) _glamor_priv_->delayed_fallback_pending = 0; } } while(0)
#define DEBUGF(str, ...) #define DEBUGF(str, ...) do {} while(0)
//#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__) //#define DEBUGF(str, ...) ErrorF(str, ##__VA_ARGS__)
#define DEBUGRegionPrint(x) do {} while (0)
//#define DEBUGRegionPrint RegionPrint
#endif #endif
...@@ -412,11 +412,11 @@ glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv) ...@@ -412,11 +412,11 @@ glamor_pixmap_detach_fbo(glamor_pixmap_private *pixmap_priv)
if (pixmap_priv == NULL) if (pixmap_priv == NULL)
return NULL; return NULL;
fbo = pixmap_priv->fbo; fbo = pixmap_priv->base.fbo;
if (fbo == NULL) if (fbo == NULL)
return NULL; return NULL;
pixmap_priv->fbo = NULL; pixmap_priv->base.fbo = NULL;
return fbo; return fbo;
} }
...@@ -434,25 +434,25 @@ glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo) ...@@ -434,25 +434,25 @@ glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo)
pixmap_priv = calloc(1, sizeof(*pixmap_priv)); pixmap_priv = calloc(1, sizeof(*pixmap_priv));
dixSetPrivate(&pixmap->devPrivates, dixSetPrivate(&pixmap->devPrivates,
glamor_pixmap_private_key, pixmap_priv); glamor_pixmap_private_key, pixmap_priv);
pixmap_priv->container = pixmap; pixmap_priv->base.pixmap = pixmap;
pixmap_priv->glamor_priv = glamor_priv; pixmap_priv->base.glamor_priv = glamor_priv;
pixmap_priv->type = GLAMOR_MEMORY; pixmap_priv->type = GLAMOR_MEMORY;
} }
if (pixmap_priv->fbo) if (pixmap_priv->base.fbo)
return; return;
pixmap_priv->fbo = fbo; pixmap_priv->base.fbo = fbo;
switch (pixmap_priv->type) { switch (pixmap_priv->type) {
case GLAMOR_TEXTURE_ONLY: case GLAMOR_TEXTURE_ONLY:
case GLAMOR_TEXTURE_DRM: case GLAMOR_TEXTURE_DRM:
pixmap_priv->gl_fbo = 1; pixmap_priv->base.gl_fbo = 1;
if (fbo->tex != 0) if (fbo->tex != 0)
pixmap_priv->gl_tex = 1; pixmap_priv->base.gl_tex = 1;
else { else {
/* XXX For the Xephyr only, may be broken now.*/ /* XXX For the Xephyr only, may be broken now.*/
pixmap_priv->gl_tex = 0; pixmap_priv->base.gl_tex = 0;
} }
case GLAMOR_MEMORY_MAP: case GLAMOR_MEMORY_MAP:
pixmap->devPrivate.ptr = NULL; pixmap->devPrivate.ptr = NULL;
...@@ -472,7 +472,7 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag) ...@@ -472,7 +472,7 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv == NULL || pixmap_priv->fbo == NULL) { if (pixmap_priv == NULL || pixmap_priv->base.fbo == NULL) {
fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width, fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width,
pixmap->drawable.height, pixmap->drawable.height,
...@@ -484,12 +484,12 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag) ...@@ -484,12 +484,12 @@ glamor_pixmap_ensure_fbo(PixmapPtr pixmap, GLenum format, int flag)
glamor_pixmap_attach_fbo(pixmap, fbo); glamor_pixmap_attach_fbo(pixmap, fbo);
} else { } else {
/* We do have a fbo, but it may lack of fb or tex. */ /* We do have a fbo, but it may lack of fb or tex. */
if (!pixmap_priv->fbo->tex) if (!pixmap_priv->base.fbo->tex)
pixmap_priv->fbo->tex = _glamor_create_tex(glamor_priv, pixmap->drawable.width, pixmap_priv->base.fbo->tex = _glamor_create_tex(glamor_priv, pixmap->drawable.width,
pixmap->drawable.height, format); pixmap->drawable.height, format);
if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->fbo->fb == 0) if (flag != GLAMOR_CREATE_FBO_NO_FBO && pixmap_priv->base.fbo->fb == 0)
glamor_pixmap_ensure_fb(pixmap_priv->fbo); glamor_pixmap_ensure_fb(pixmap_priv->base.fbo);
} }
pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv = glamor_get_pixmap_private(pixmap);
...@@ -504,7 +504,7 @@ glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back) ...@@ -504,7 +504,7 @@ glamor_pixmap_exchange_fbos(PixmapPtr front, PixmapPtr back)
front_priv = glamor_get_pixmap_private(front); front_priv = glamor_get_pixmap_private(front);
back_priv = glamor_get_pixmap_private(back); back_priv = glamor_get_pixmap_private(back);
temp_fbo = front_priv->fbo; temp_fbo = front_priv->base.fbo;
front_priv->fbo = back_priv->fbo; front_priv->base.fbo = back_priv->base.fbo;
back_priv->fbo = temp_fbo; back_priv->base.fbo = temp_fbo;
} }
...@@ -239,7 +239,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height, ...@@ -239,7 +239,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale); pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale);
glamor_set_normalize_vcoords(xscale, yscale, x1, y1, x2, y2, glamor_set_normalize_vcoords(pixmap_priv, xscale, yscale, x1, y1, x2, y2,
glamor_priv->yInverted, vertices); glamor_priv->yInverted, vertices);
dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4); dispatch->glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS); dispatch->glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
......
...@@ -806,14 +806,14 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen, ...@@ -806,14 +806,14 @@ _glamor_gradient_set_pixmap_destination(ScreenPtr screen,
*xscale, *yscale, x_source, y_source, *xscale, *yscale, x_source, y_source,
dst_picture->pDrawable->width, dst_picture->pDrawable->height); dst_picture->pDrawable->width, dst_picture->pDrawable->height);
glamor_set_normalize_vcoords(*xscale, *yscale, glamor_set_normalize_vcoords(pixmap_priv, *xscale, *yscale,
0, 0, 0, 0,
(INT16)(dst_picture->pDrawable->width), (INT16)(dst_picture->pDrawable->width),
(INT16)(dst_picture->pDrawable->height), (INT16)(dst_picture->pDrawable->height),
glamor_priv->yInverted, vertices); glamor_priv->yInverted, vertices);
if (tex_normalize) { if (tex_normalize) {
glamor_set_normalize_tcoords(*xscale, *yscale, glamor_set_normalize_tcoords(pixmap_priv, *xscale, *yscale,
x_source, y_source, x_source, y_source,
(INT16)(dst_picture->pDrawable->width + x_source), (INT16)(dst_picture->pDrawable->width + x_source),
(INT16)(dst_picture->pDrawable->height + y_source), (INT16)(dst_picture->pDrawable->height + y_source),
......
...@@ -101,8 +101,8 @@ glamor_create_picture(PicturePtr picture) ...@@ -101,8 +101,8 @@ glamor_create_picture(PicturePtr picture)
} }
} }
pixmap_priv->is_picture = 1; pixmap_priv->base.is_picture = 1;
pixmap_priv->pict_format = picture->format; pixmap_priv->base.picture = picture;
return miCreatePicture(picture); return miCreatePicture(picture);
} }
...@@ -123,8 +123,8 @@ glamor_destroy_picture(PicturePtr picture) ...@@ -123,8 +123,8 @@ glamor_destroy_picture(PicturePtr picture)
pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv) { if (pixmap_priv) {
pixmap_priv->is_picture = 0; pixmap_priv->base.is_picture = 0;
pixmap_priv->pict_format = 0; pixmap_priv->base.picture = NULL;
} }
miDestroyPicture(picture); miDestroyPicture(picture);
} }
...@@ -133,5 +133,5 @@ void ...@@ -133,5 +133,5 @@ void
glamor_picture_format_fixup(PicturePtr picture, glamor_picture_format_fixup(PicturePtr picture,
glamor_pixmap_private * pixmap_priv) glamor_pixmap_private * pixmap_priv)
{ {
pixmap_priv->pict_format = picture->format; pixmap_priv->base.picture = picture;
} }
...@@ -83,9 +83,9 @@ glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo * fbo, int x0, int y0, int w ...@@ -83,9 +83,9 @@ glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo * fbo, int x0, int y0, int w
void void
glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private * pixmap_priv) glamor_set_destination_pixmap_priv_nc(glamor_pixmap_private * pixmap_priv)
{ {
glamor_set_destination_pixmap_fbo(pixmap_priv->fbo, 0, 0, glamor_set_destination_pixmap_fbo(pixmap_priv->base.fbo, 0, 0,
pixmap_priv->container->drawable.width, pixmap_priv->base.pixmap->drawable.width,
pixmap_priv->container->drawable.height); pixmap_priv->base.pixmap->drawable.height);
} }
int int
...@@ -495,8 +495,8 @@ ready_to_upload: ...@@ -495,8 +495,8 @@ ready_to_upload:
&& revert == REVERT_NONE && revert == REVERT_NONE
&& swap_rb == SWAP_NONE_UPLOADING && swap_rb == SWAP_NONE_UPLOADING
&& !need_flip) { && !need_flip) {
assert(pixmap_priv->fbo->tex); assert(pixmap_priv->base.fbo->tex);
__glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->fbo->tex, __glamor_upload_pixmap_to_texture(pixmap, &pixmap_priv->base.fbo->tex,
format, type, format, type,
x, y, w, h, x, y, w, h,
bits, pbo); bits, pbo);
...@@ -509,7 +509,7 @@ ready_to_upload: ...@@ -509,7 +509,7 @@ ready_to_upload:
ptexcoords = texcoords_inv; ptexcoords = texcoords_inv;
pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale); pixmap_priv_get_dest_scale(pixmap_priv, &dst_xscale, &dst_yscale);
glamor_set_normalize_vcoords(dst_xscale, glamor_set_normalize_vcoords(pixmap_priv, dst_xscale,
dst_yscale, dst_yscale,
x, y, x, y,
x + w, y + h, x + w, y + h,
...@@ -586,14 +586,14 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha, int ...@@ -586,14 +586,14 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha, int
pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv = glamor_get_pixmap_private(pixmap);
glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen); glamor_priv = glamor_get_screen_private(pixmap->drawable.pScreen);
if (pixmap_priv->fbo if (pixmap_priv->base.fbo
&& (pixmap_priv->fbo->width < pixmap->drawable.width && (pixmap_priv->base.fbo->width < pixmap->drawable.width
|| pixmap_priv->fbo->height < pixmap->drawable.height)) { || pixmap_priv->base.fbo->height < pixmap->drawable.height)) {
fbo = glamor_pixmap_detach_fbo(pixmap_priv); fbo = glamor_pixmap_detach_fbo(pixmap_priv);
glamor_destroy_fbo(fbo); glamor_destroy_fbo(fbo);
} }
if (pixmap_priv->fbo && pixmap_priv->fbo->fb) if (pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb)
return 0; return 0;
if (!(no_alpha if (!(no_alpha
...@@ -605,8 +605,8 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha, int ...@@ -605,8 +605,8 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha, int
flag = GLAMOR_CREATE_FBO_NO_FBO; flag = GLAMOR_CREATE_FBO_NO_FBO;
} }
if ((flag == 0 && pixmap_priv && pixmap_priv->fbo && pixmap_priv->fbo->tex) if ((flag == 0 && pixmap_priv && pixmap_priv->base.fbo && pixmap_priv->base.fbo->tex)
|| (flag != 0 && pixmap_priv && pixmap_priv->fbo && pixmap_priv->fbo->fb)) || (flag != 0 && pixmap_priv && pixmap_priv->base.fbo && pixmap_priv->base.fbo->fb))
return 0; return 0;
if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP) if (glamor_priv->gl_flavor == GLAMOR_GL_DESKTOP)
...@@ -614,7 +614,7 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha, int ...@@ -614,7 +614,7 @@ glamor_pixmap_upload_prepare(PixmapPtr pixmap, GLenum format, int no_alpha, int
else else
iformat = format; iformat = format;
if (pixmap_priv == NULL || pixmap_priv->fbo == NULL) { if (pixmap_priv == NULL || pixmap_priv->base.fbo == NULL) {
fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width, fbo = glamor_create_fbo(glamor_priv, pixmap->drawable.width,
pixmap->drawable.height, pixmap->drawable.height,
...@@ -672,10 +672,10 @@ glamor_upload_pixmap_to_texture(PixmapPtr pixmap) ...@@ -672,10 +672,10 @@ glamor_upload_pixmap_to_texture(PixmapPtr pixmap)
pixmap_priv = glamor_get_pixmap_private(pixmap); pixmap_priv = glamor_get_pixmap_private(pixmap);
if (pixmap_priv if (pixmap_priv
&& (pixmap_priv->fbo) && (pixmap_priv->base.fbo)
&& (pixmap_priv->fbo->pbo_valid)) { && (pixmap_priv->base.fbo->pbo_valid)) {
data = NULL; data = NULL;
pbo = pixmap_priv->fbo->pbo; pbo = pixmap_priv->base.fbo->pbo;
} else { } else {
data = pixmap->devPrivate.ptr; data = pixmap->devPrivate.ptr;
pbo = 0; pbo = 0;
...@@ -737,7 +737,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, GLe ...@@ -737,7 +737,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, GLe
temp_xscale = 1.0 / w; temp_xscale = 1.0 / w;
temp_yscale = 1.0 / h; temp_yscale = 1.0 / h;
glamor_set_normalize_vcoords(temp_xscale, glamor_set_normalize_vcoords((glamor_pixmap_private *)NULL, temp_xscale,
temp_yscale, temp_yscale,
0, 0, 0, 0,
w, h, w, h,
...@@ -750,7 +750,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, GLe ...@@ -750,7 +750,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, GLe
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS); dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
pixmap_priv_get_scale(source_priv, &source_xscale, &source_yscale); pixmap_priv_get_scale(source_priv, &source_xscale, &source_yscale);
glamor_set_normalize_tcoords(source_xscale, glamor_set_normalize_tcoords(source_priv, source_xscale,
source_yscale, source_yscale,
x, y, x, y,
x + w, y + h, x + w, y + h,
...@@ -763,7 +763,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, GLe ...@@ -763,7 +763,7 @@ glamor_es2_pixmap_read_prepare(PixmapPtr source, int x, int y, int w, int h, GLe
dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE); dispatch->glEnableVertexAttribArray(GLAMOR_VERTEX_SOURCE);
dispatch->glActiveTexture(GL_TEXTURE0); dispatch->glActiveTexture(GL_TEXTURE0);
dispatch->glBindTexture(GL_TEXTURE_2D, source_priv->fbo->tex); dispatch->glBindTexture(GL_TEXTURE_2D, source_priv->base.fbo->tex);
dispatch->glTexParameteri(GL_TEXTURE_2D, dispatch->glTexParameteri(GL_TEXTURE_2D,
GL_TEXTURE_MIN_FILTER, GL_TEXTURE_MIN_FILTER,
GL_NEAREST); GL_NEAREST);
...@@ -988,16 +988,16 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access) ...@@ -988,16 +988,16 @@ glamor_download_pixmap_to_cpu(PixmapPtr pixmap, glamor_access_t access)
data = malloc(stride * pixmap->drawable.height); data = malloc(stride * pixmap->drawable.height);
} else { } else {
dispatch = glamor_get_dispatch(glamor_priv); dispatch = glamor_get_dispatch(glamor_priv);
if (pixmap_priv->fbo->pbo == 0) if (pixmap_priv->base.fbo->pbo == 0)
dispatch->glGenBuffers(1, dispatch->glGenBuffers(1,
&pixmap_priv->fbo->pbo); &pixmap_priv->base.fbo->pbo);
glamor_put_dispatch(glamor_priv); glamor_put_dispatch(glamor_priv);
pbo = pixmap_priv->fbo->pbo; pbo = pixmap_priv->