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, dx, dy, reverse, upsidedown, bitplane,
closure); closure);
if (dst != src) 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: done:

View File

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

View File

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

View File

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

View File

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

View File

@ -33,12 +33,12 @@ glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access)
} }
void void
glamor_finish_access_picture(PicturePtr picture) glamor_finish_access_picture(PicturePtr picture, glamor_access_t access)
{ {
if (!picture || !picture->pDrawable) if (!picture || !picture->pDrawable)
return; 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); fbPolyFillRect(drawable, gc, nrect, prect);
glamor_finish_access_gc(gc); glamor_finish_access_gc(gc);
} }
glamor_finish_access(drawable); glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
} }
return TRUE; 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); fbPolyLine(temp_dest, gc, mode, n, points);
glamor_finish_access_gc(gc); glamor_finish_access_gc(gc);
} }
glamor_finish_access(temp_dest); glamor_finish_access(temp_dest, GLAMOR_ACCESS_RW);
} }
} else { } else {
/* fb calls mi functions in the lineWidth != 0 case. */ /* fb calls mi functions in the lineWidth != 0 case. */

View File

@ -226,7 +226,6 @@ typedef union _glamor_pending_op {
* @tex: attached texture. * @tex: attached texture.
* @fb: attached fbo. * @fb: attached fbo.
* @pbo: attached pbo. * @pbo: attached pbo.
* @access_mode: access mode during the prepare/finish pair.
* @pict_format: the corresponding picture's format. * @pict_format: the corresponding picture's format.
* #pending_op: currently only support pending filling. * #pending_op: currently only support pending filling.
* @container: The corresponding pixmap's pointer. * @container: The corresponding pixmap's pointer.
@ -240,7 +239,6 @@ typedef struct glamor_pixmap_private {
GLuint tex; GLuint tex;
GLuint fb; GLuint fb;
GLuint pbo; GLuint pbo;
glamor_access_t access_mode;
PictFormatShort pict_format; PictFormatShort pict_format;
glamor_pending_op pending_op; glamor_pending_op pending_op;
PixmapPtr container; PixmapPtr container;
@ -316,7 +314,7 @@ void glamor_copy_window(WindowPtr win, DDXPointRec old_origin,
/* glamor_core.c */ /* glamor_core.c */
Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access); 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); Bool glamor_prepare_access_window(WindowPtr window);
void glamor_finish_access_window(WindowPtr window); void glamor_finish_access_window(WindowPtr window);
Bool glamor_prepare_access_gc(GCPtr gc); Bool glamor_prepare_access_gc(GCPtr gc);
@ -524,7 +522,7 @@ int glamor_create_picture(PicturePtr picture);
Bool Bool
glamor_prepare_access_picture(PicturePtr picture, glamor_access_t access); 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); 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)) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
fbPutImage(drawable, gc, 1, x, y, w, h, left_pad, XYBitmap, fbPutImage(drawable, gc, 1, x, y, w, h, left_pad, XYBitmap,
bits); bits);
glamor_finish_access(drawable); glamor_finish_access(drawable, GLAMOR_ACCESS_RW);
} }
} }
#endif #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)) { if (glamor_prepare_access(&pixmap->drawable, GLAMOR_ACCESS_RW)) {
fbPutImage(&pixmap->drawable, gc, depth, x, y, w, h, fbPutImage(&pixmap->drawable, gc, depth, x, y, w, h,
left_pad, image_format, bits); left_pad, image_format, bits);
glamor_finish_access(&pixmap->drawable); glamor_finish_access(&pixmap->drawable, GLAMOR_ACCESS_RW);
} }
return TRUE; return TRUE;
} }

View File

@ -1366,11 +1366,11 @@ _glamor_composite(CARD8 op,
x_mask, y_mask, x_dest, x_mask, y_mask, x_dest,
y_dest, width, height); y_dest, width, height);
if (mask) 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: done:
if (temp_src != source) 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)); drawable, glamor_get_drawable_location(drawable));
if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) { if (glamor_prepare_access(drawable, GLAMOR_ACCESS_RW)) {
fbSetSpans(drawable, gc, src, points, widths, n, sorted); 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); ySrc, ntris, tris);
} }
if (pSrc->pDrawable != NULL) 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; return TRUE;
} }