diff --git a/glamor/glamor_prepare.c b/glamor/glamor_prepare.c index f7bb5d254..208319628 100644 --- a/glamor/glamor_prepare.c +++ b/glamor/glamor_prepare.c @@ -25,19 +25,21 @@ #include "glamor_transfer.h" /* - * Make a pixmap ready to draw with fb by + * Make a drawable ready to draw with fb by * creating a PBO large enough for the whole object * and downloading all of the FBOs into it. */ static Bool -glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box) +glamor_prep_drawable_box(DrawablePtr drawable, glamor_access_t access, BoxPtr box) { - ScreenPtr screen = pixmap->drawable.pScreen; + ScreenPtr screen = drawable->pScreen; glamor_screen_private *glamor_priv = glamor_get_screen_private(screen); + PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap); int gl_access, gl_usage; RegionRec region; + int off_x, off_y; if (priv->type == GLAMOR_DRM_ONLY) return FALSE; @@ -47,6 +49,11 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box) glamor_make_current(glamor_priv); + glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); + box->x1 += off_x; + box->x2 += off_x; + box->y1 += off_y; + box->y2 += off_y; RegionInit(®ion, box, 1); /* See if it's already mapped */ @@ -119,7 +126,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box) priv->map_access = access; } - glamor_download_boxes(&pixmap->drawable, RegionRects(®ion), RegionNumRects(®ion), + glamor_download_boxes(drawable, RegionRects(®ion), RegionNumRects(®ion), 0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind); RegionUninit(®ion); @@ -185,33 +192,26 @@ glamor_finish_access(DrawablePtr drawable) Bool glamor_prepare_access(DrawablePtr drawable, glamor_access_t access) { - PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); BoxRec box; - int off_x, off_y; - glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); - - box.x1 = drawable->x + off_x; + box.x1 = drawable->x; box.x2 = box.x1 + drawable->width; - box.y1 = drawable->y + off_y; + box.y1 = drawable->y; box.y2 = box.y1 + drawable->height; - return glamor_prep_pixmap_box(pixmap, access, &box); + return glamor_prep_drawable_box(drawable, access, &box); } Bool glamor_prepare_access_box(DrawablePtr drawable, glamor_access_t access, int x, int y, int w, int h) { - PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable); BoxRec box; - int off_x, off_y; - glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y); - box.x1 = drawable->x + x + off_x; + box.x1 = drawable->x + x; box.x2 = box.x1 + w; - box.y1 = drawable->y + y + off_y; + box.y1 = drawable->y + y; box.y2 = box.y1 + h; - return glamor_prep_pixmap_box(pixmap, access, &box); + return glamor_prep_drawable_box(drawable, access, &box); } /*