Remove the access mode from private pixmap structure.

Change the finish_access to pass in the access mode, and remove
the access mode from the pixmap structure. This element should
not be a pixmap's property.

Signed-off-by: Zhigang Gong <zhigang.gong@linux.intel.com>
This commit is contained in:
Zhigang Gong 2011-12-11 02:26:15 +08:00 committed by Eric Anholt
parent d135e879a6
commit 92fd83872f
13 changed files with 29 additions and 30 deletions

View File

@ -422,9 +422,9 @@ _glamor_copy_n_to_n(DrawablePtr src,
dx, dy, reverse, upsidedown, bitplane,
closure);
if (dst != src)
glamor_finish_access(src);
glamor_finish_access(src, GLAMOR_ACCESS_RO);
}
glamor_finish_access(dst);
glamor_finish_access(dst, GLAMOR_ACCESS_RW);
}
done:

View File

@ -255,7 +255,7 @@ glamor_init_finish_access_shaders(ScreenPtr screen)
}
void
glamor_finish_access(DrawablePtr drawable)
glamor_finish_access(DrawablePtr drawable, glamor_access_t access_mode)
{
PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
glamor_pixmap_private *pixmap_priv =
@ -267,7 +267,7 @@ glamor_finish_access(DrawablePtr drawable)
if (!pixmap_priv || !GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
return;
if (pixmap_priv->access_mode != GLAMOR_ACCESS_RO) {
if (access_mode != GLAMOR_ACCESS_RO) {
glamor_restore_pixmap_to_texture(pixmap);
}
@ -307,7 +307,8 @@ glamor_prepare_access_gc(GCPtr gc)
GLAMOR_ACCESS_RO)) {
if (gc->stipple)
glamor_finish_access(&gc->
stipple->drawable);
stipple->drawable,
GLAMOR_ACCESS_RO);
return FALSE;
}
}
@ -321,9 +322,9 @@ void
glamor_finish_access_gc(GCPtr gc)
{
if (gc->fillStyle == FillTiled)
glamor_finish_access(&gc->tile.pixmap->drawable);
glamor_finish_access(&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RO);
if (gc->stipple)
glamor_finish_access(&gc->stipple->drawable);
glamor_finish_access(&gc->stipple->drawable, GLAMOR_ACCESS_RO);
}
Bool
@ -406,7 +407,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
(old_tile,
drawable->bitsPerPixel);
glamor_finish_access
(&old_tile->drawable);
(&old_tile->drawable, GLAMOR_ACCESS_RO);
}
}
if (new_tile) {
@ -432,7 +433,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
GLAMOR_ACCESS_RW)) {
fbPadPixmap(gc->tile.pixmap);
glamor_finish_access
(&gc->tile.pixmap->drawable);
(&gc->tile.pixmap->drawable, GLAMOR_ACCESS_RW);
}
}
}
@ -449,7 +450,7 @@ glamor_validate_gc(GCPtr gc, unsigned long changes, DrawablePtr drawable)
if (glamor_prepare_access
(&gc->stipple->drawable, GLAMOR_ACCESS_RW)) {
fbValidateGC(gc, changes, drawable);
glamor_finish_access(&gc->stipple->drawable);
glamor_finish_access(&gc->stipple->drawable, GLAMOR_ACCESS_RW);
}
} else {
fbValidateGC(gc, changes, drawable);
@ -491,7 +492,7 @@ glamor_bitmap_to_region(PixmapPtr pixmap)
if (!glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RO))
return NULL;
ret = fbPixmapToRegion(pixmap);
glamor_finish_access(&pixmap->drawable);
glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RO);
return ret;
}

View File

@ -88,7 +88,7 @@ glamor_fill(DrawablePtr drawable,
fbFill(drawable, gc, x, y, width, height);
glamor_finish_access_gc(gc);
}
glamor_finish_access(drawable);
glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
}
return TRUE;
}

View File

@ -83,7 +83,7 @@ _glamor_fill_spans(DrawablePtr drawable,
sorted);
glamor_finish_access_gc(gc);
}
glamor_finish_access(drawable);
glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
}
return TRUE;
}

View File

@ -101,7 +101,7 @@ glamor_get_spans(DrawablePtr drawable,
glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RO)) {
fbGetSpans(drawable, wmax, points, widths, count, dst);
glamor_finish_access(drawable);
glamor_finish_access(drawable, GLAMOR_ACCESS_RO);
}
}

View File

@ -33,12 +33,12 @@ glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access)
}
void
glamor_finish_access_picture(PicturePtr picture)
glamor_finish_access_picture(PicturePtr picture, glamor_access_t access)
{
if (!picture || !picture->pDrawable)
return;
glamor_finish_access(picture->pDrawable);
glamor_finish_access(picture->pDrawable, access);
}
/*

View File

@ -102,7 +102,7 @@ _glamor_poly_fill_rect(DrawablePtr drawable,
fbPolyFillRect(drawable, gc, nrect, prect);
glamor_finish_access_gc(gc);
}
glamor_finish_access(drawable);
glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
}
return TRUE;
}

View File

@ -151,7 +151,7 @@ glamor_poly_lines(DrawablePtr drawable, GCPtr gc, int mode, int n,
fbPolyLine(temp_dest, gc, mode, n, points);
glamor_finish_access_gc(gc);
}
glamor_finish_access(temp_dest);
glamor_finish_access(temp_dest, GLAMOR_ACCESS_RW);
}
} else {
/* fb calls mi functions in the lineWidth != 0 case. */

View File

@ -226,7 +226,6 @@ typedef union _glamor_pending_op {
* @tex: attached texture.
* @fb: attached fbo.
* @pbo: attached pbo.
* @access_mode: access mode during the prepare/finish pair.
* @pict_format: the corresponding picture's format.
* #pending_op: currently only support pending filling.
* @container: The corresponding pixmap's pointer.
@ -240,7 +239,6 @@ typedef struct glamor_pixmap_private {
GLuint tex;
GLuint fb;
GLuint pbo;
glamor_access_t access_mode;
PictFormatShort pict_format;
glamor_pending_op pending_op;
PixmapPtr container;
@ -316,7 +314,7 @@ void glamor_copy_window(WindowPtr win, DDXPointRec old_origin,
/* glamor_core.c */
Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access);
void glamor_finish_access(DrawablePtr drawable);
void glamor_finish_access(DrawablePtr drawable, glamor_access_t access);
Bool glamor_prepare_access_window(WindowPtr window);
void glamor_finish_access_window(WindowPtr window);
Bool glamor_prepare_access_gc(GCPtr gc);
@ -524,7 +522,7 @@ int glamor_create_picture(PicturePtr picture);
Bool
glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access);
void glamor_finish_access_picture(PicturePtr picture);
void glamor_finish_access_picture(PicturePtr picture, glamor_access_t access);
void glamor_destroy_picture(PicturePtr picture);

View File

@ -234,7 +234,7 @@ glamor_put_image_xybitmap(DrawablePtr drawable, GCPtr gc,
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
fbPutImage(drawable, gc, 1, x, y, w, h, left_pad, XYBitmap,
bits);
glamor_finish_access(drawable);
glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
}
}
#endif
@ -401,7 +401,7 @@ _glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
if (glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RW)) {
fbPutImage(&pixmap->drawable, gc, depth, x, y, w, h,
left_pad, image_format, bits);
glamor_finish_access(&pixmap->drawable);
glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RW);
}
return TRUE;
}

View File

@ -1366,11 +1366,11 @@ _glamor_composite(CARD8 op,
x_mask, y_mask, x_dest,
y_dest, width, height);
if (mask)
glamor_finish_access_picture(mask);
glamor_finish_access_picture(mask, GLAMOR_ACCESS_RO);
}
glamor_finish_access_picture(source);
glamor_finish_access_picture(source, GLAMOR_ACCESS_RO);
}
glamor_finish_access_picture(dest);
glamor_finish_access_picture(dest, GLAMOR_ACCESS_RW);
}
done:
if (temp_src != source)

View File

@ -101,6 +101,6 @@ glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
drawable, glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
fbSetSpans(drawable, gc, src, points, widths, n, sorted);
glamor_finish_access(drawable);
glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
}
}

View File

@ -50,9 +50,9 @@ _glamor_triangles(CARD8 op,
ySrc, ntris, tris);
}
if (pSrc->pDrawable != NULL)
glamor_finish_access(pSrc->pDrawable);
glamor_finish_access(pSrc->pDrawable, GLAMOR_ACCESS_RO);
glamor_finish_access(pDst->pDrawable);
glamor_finish_access(pDst->pDrawable, GLAMOR_ACCESS_RW);
}
return TRUE;
}