glamor: Take DrawablePtr instead of PixmapPtr in up/download_boxes
Will allow for better results if the window depth doesn't match the backing pixmap depth.
This commit is contained in:
parent
5893de5a22
commit
a504f65d89
|
@ -107,7 +107,7 @@ glamor_copy_glyph(PixmapPtr glyph_pixmap,
|
||||||
glyph_draw->height,
|
glyph_draw->height,
|
||||||
0, 0, 0x1);
|
0, 0, 0x1);
|
||||||
}
|
}
|
||||||
glamor_upload_boxes((PixmapPtr) atlas_draw,
|
glamor_upload_boxes(atlas_draw,
|
||||||
&box, 1,
|
&box, 1,
|
||||||
0, 0,
|
0, 0,
|
||||||
x, y,
|
x, y,
|
||||||
|
|
|
@ -255,7 +255,7 @@ glamor_copy_cpu_fbo(DrawablePtr src,
|
||||||
fbCopy1toN(src, &tmp_pix->drawable, gc, box, nbox, dx, dy,
|
fbCopy1toN(src, &tmp_pix->drawable, gc, box, nbox, dx, dy,
|
||||||
reverse, upsidedown, bitplane, closure);
|
reverse, upsidedown, bitplane, closure);
|
||||||
|
|
||||||
glamor_upload_boxes(dst_pixmap, box, nbox, tmp_xoff, tmp_yoff,
|
glamor_upload_boxes(dst, box, nbox, tmp_xoff, tmp_yoff,
|
||||||
dst_xoff, dst_yoff, (uint8_t *) tmp_bits,
|
dst_xoff, dst_yoff, (uint8_t *) tmp_bits,
|
||||||
tmp_stride * sizeof(FbBits));
|
tmp_stride * sizeof(FbBits));
|
||||||
fbDestroyPixmap(tmp_pix);
|
fbDestroyPixmap(tmp_pix);
|
||||||
|
@ -266,7 +266,7 @@ glamor_copy_cpu_fbo(DrawablePtr src,
|
||||||
int src_xoff, src_yoff;
|
int src_xoff, src_yoff;
|
||||||
|
|
||||||
fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
|
fbGetDrawable(src, src_bits, src_stride, src_bpp, src_xoff, src_yoff);
|
||||||
glamor_upload_boxes(dst_pixmap, box, nbox, src_xoff + dx, src_yoff + dy,
|
glamor_upload_boxes(dst, box, nbox, src_xoff + dx, src_yoff + dy,
|
||||||
dst_xoff, dst_yoff,
|
dst_xoff, dst_yoff,
|
||||||
(uint8_t *) src_bits, src_stride * sizeof (FbBits));
|
(uint8_t *) src_bits, src_stride * sizeof (FbBits));
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ glamor_copy_fbo_cpu(DrawablePtr src,
|
||||||
|
|
||||||
fbGetDrawable(dst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff);
|
fbGetDrawable(dst, dst_bits, dst_stride, dst_bpp, dst_xoff, dst_yoff);
|
||||||
|
|
||||||
glamor_download_boxes(src_pixmap, box, nbox, src_xoff + dx, src_yoff + dy,
|
glamor_download_boxes(src, box, nbox, src_xoff + dx, src_yoff + dy,
|
||||||
dst_xoff, dst_yoff,
|
dst_xoff, dst_yoff,
|
||||||
(uint8_t *) dst_bits, dst_stride * sizeof (FbBits));
|
(uint8_t *) dst_bits, dst_stride * sizeof (FbBits));
|
||||||
glamor_finish_access(dst);
|
glamor_finish_access(dst);
|
||||||
|
|
|
@ -76,7 +76,7 @@ glamor_put_image_gl(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
|
||||||
|
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
||||||
glamor_upload_region(pixmap, ®ion, x, y, (uint8_t *) bits, byte_stride);
|
glamor_upload_region(drawable, ®ion, x, y, (uint8_t *) bits, byte_stride);
|
||||||
|
|
||||||
RegionUninit(®ion);
|
RegionUninit(®ion);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -124,7 +124,7 @@ glamor_get_image_gl(DrawablePtr drawable, int x, int y, int w, int h,
|
||||||
box.x2 = x + w;
|
box.x2 = x + w;
|
||||||
box.y1 = y;
|
box.y1 = y;
|
||||||
box.y2 = y + h;
|
box.y2 = y + h;
|
||||||
glamor_download_boxes(pixmap, &box, 1,
|
glamor_download_boxes(drawable, &box, 1,
|
||||||
drawable->x + off_x, drawable->y + off_y,
|
drawable->x + off_x, drawable->y + off_y,
|
||||||
-x, -y,
|
-x, -y,
|
||||||
(uint8_t *) d, byte_stride);
|
(uint8_t *) d, byte_stride);
|
||||||
|
|
|
@ -119,7 +119,7 @@ glamor_prep_pixmap_box(PixmapPtr pixmap, glamor_access_t access, BoxPtr box)
|
||||||
priv->map_access = access;
|
priv->map_access = access;
|
||||||
}
|
}
|
||||||
|
|
||||||
glamor_download_boxes(pixmap, RegionRects(®ion), RegionNumRects(®ion),
|
glamor_download_boxes(&pixmap->drawable, RegionRects(®ion), RegionNumRects(®ion),
|
||||||
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
|
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
|
||||||
|
|
||||||
RegionUninit(®ion);
|
RegionUninit(®ion);
|
||||||
|
@ -161,7 +161,7 @@ glamor_fini_pixmap(PixmapPtr pixmap)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->map_access == GLAMOR_ACCESS_RW) {
|
if (priv->map_access == GLAMOR_ACCESS_RW) {
|
||||||
glamor_upload_boxes(pixmap,
|
glamor_upload_boxes(&pixmap->drawable,
|
||||||
RegionRects(&priv->prepare_region),
|
RegionRects(&priv->prepare_region),
|
||||||
RegionNumRects(&priv->prepare_region),
|
RegionNumRects(&priv->prepare_region),
|
||||||
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
|
0, 0, 0, 0, pixmap->devPrivate.ptr, pixmap->devKind);
|
||||||
|
|
|
@ -24,19 +24,20 @@
|
||||||
#include "glamor_transfer.h"
|
#include "glamor_transfer.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write a region of bits into a pixmap
|
* Write a region of bits into a drawable's backing pixmap
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
glamor_upload_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox,
|
||||||
int dx_src, int dy_src,
|
int dx_src, int dy_src,
|
||||||
int dx_dst, int dy_dst,
|
int dx_dst, int dy_dst,
|
||||||
uint8_t *bits, uint32_t byte_stride)
|
uint8_t *bits, uint32_t byte_stride)
|
||||||
{
|
{
|
||||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
ScreenPtr screen = drawable->pScreen;
|
||||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
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);
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
int box_index;
|
int box_index;
|
||||||
int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
|
int bytes_per_pixel = drawable->bitsPerPixel >> 3;
|
||||||
const struct glamor_format *f = glamor_format_for_pixmap(pixmap);
|
const struct glamor_format *f = glamor_format_for_pixmap(pixmap);
|
||||||
|
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
@ -97,30 +98,31 @@ glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_upload_region(PixmapPtr pixmap, RegionPtr region,
|
glamor_upload_region(DrawablePtr drawable, RegionPtr region,
|
||||||
int region_x, int region_y,
|
int region_x, int region_y,
|
||||||
uint8_t *bits, uint32_t byte_stride)
|
uint8_t *bits, uint32_t byte_stride)
|
||||||
{
|
{
|
||||||
glamor_upload_boxes(pixmap, RegionRects(region), RegionNumRects(region),
|
glamor_upload_boxes(drawable, RegionRects(region), RegionNumRects(region),
|
||||||
-region_x, -region_y,
|
-region_x, -region_y,
|
||||||
0, 0,
|
0, 0,
|
||||||
bits, byte_stride);
|
bits, byte_stride);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read stuff from the pixmap FBOs and write to memory
|
* Read stuff from the drawable's backing pixmap FBOs and write to memory
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
glamor_download_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox,
|
||||||
int dx_src, int dy_src,
|
int dx_src, int dy_src,
|
||||||
int dx_dst, int dy_dst,
|
int dx_dst, int dy_dst,
|
||||||
uint8_t *bits, uint32_t byte_stride)
|
uint8_t *bits, uint32_t byte_stride)
|
||||||
{
|
{
|
||||||
ScreenPtr screen = pixmap->drawable.pScreen;
|
ScreenPtr screen = drawable->pScreen;
|
||||||
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
|
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);
|
glamor_pixmap_private *priv = glamor_get_pixmap_private(pixmap);
|
||||||
int box_index;
|
int box_index;
|
||||||
int bytes_per_pixel = pixmap->drawable.bitsPerPixel >> 3;
|
int bytes_per_pixel = drawable->bitsPerPixel >> 3;
|
||||||
const struct glamor_format *f = glamor_format_for_pixmap(pixmap);
|
const struct glamor_format *f = glamor_format_for_pixmap(pixmap);
|
||||||
|
|
||||||
glamor_make_current(glamor_priv);
|
glamor_make_current(glamor_priv);
|
||||||
|
|
|
@ -24,18 +24,18 @@
|
||||||
#define _GLAMOR_TRANSFER_H_
|
#define _GLAMOR_TRANSFER_H_
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_upload_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
glamor_upload_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox,
|
||||||
int dx_src, int dy_src,
|
int dx_src, int dy_src,
|
||||||
int dx_dst, int dy_dst,
|
int dx_dst, int dy_dst,
|
||||||
uint8_t *bits, uint32_t byte_stride);
|
uint8_t *bits, uint32_t byte_stride);
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_upload_region(PixmapPtr pixmap, RegionPtr region,
|
glamor_upload_region(DrawablePtr drawable, RegionPtr region,
|
||||||
int region_x, int region_y,
|
int region_x, int region_y,
|
||||||
uint8_t *bits, uint32_t byte_stride);
|
uint8_t *bits, uint32_t byte_stride);
|
||||||
|
|
||||||
void
|
void
|
||||||
glamor_download_boxes(PixmapPtr pixmap, BoxPtr in_boxes, int in_nbox,
|
glamor_download_boxes(DrawablePtr drawable, BoxPtr in_boxes, int in_nbox,
|
||||||
int dx_src, int dy_src,
|
int dx_src, int dy_src,
|
||||||
int dx_dst, int dy_dst,
|
int dx_dst, int dy_dst,
|
||||||
uint8_t *bits, uint32_t byte_stride);
|
uint8_t *bits, uint32_t byte_stride);
|
||||||
|
|
|
@ -584,15 +584,15 @@ glamor_xv_put_image(glamor_port_private *port_priv,
|
||||||
half_box.x2 = width >> 1;
|
half_box.x2 = width >> 1;
|
||||||
half_box.y2 = (nlines + 1) >> 1;
|
half_box.y2 = (nlines + 1) >> 1;
|
||||||
|
|
||||||
glamor_upload_boxes(port_priv->src_pix[0], &full_box, 1,
|
glamor_upload_boxes(&port_priv->src_pix[0]->drawable, &full_box, 1,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
buf + (top * srcPitch), srcPitch);
|
buf + (top * srcPitch), srcPitch);
|
||||||
|
|
||||||
glamor_upload_boxes(port_priv->src_pix[1], &half_box, 1,
|
glamor_upload_boxes(&port_priv->src_pix[1]->drawable, &half_box, 1,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
buf + s2offset, srcPitch2);
|
buf + s2offset, srcPitch2);
|
||||||
|
|
||||||
glamor_upload_boxes(port_priv->src_pix[2], &half_box, 1,
|
glamor_upload_boxes(&port_priv->src_pix[2]->drawable, &half_box, 1,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
buf + s3offset, srcPitch2);
|
buf + s3offset, srcPitch2);
|
||||||
break;
|
break;
|
||||||
|
@ -611,11 +611,11 @@ glamor_xv_put_image(glamor_port_private *port_priv,
|
||||||
half_box.x2 = width;
|
half_box.x2 = width;
|
||||||
half_box.y2 = (nlines + 1) >> 1;
|
half_box.y2 = (nlines + 1) >> 1;
|
||||||
|
|
||||||
glamor_upload_boxes(port_priv->src_pix[0], &full_box, 1,
|
glamor_upload_boxes(&port_priv->src_pix[0]->drawable, &full_box, 1,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
buf + (top * srcPitch), srcPitch);
|
buf + (top * srcPitch), srcPitch);
|
||||||
|
|
||||||
glamor_upload_boxes(port_priv->src_pix[1], &half_box, 1,
|
glamor_upload_boxes(&port_priv->src_pix[1]->drawable, &half_box, 1,
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
buf + s2offset, srcPitch);
|
buf + s2offset, srcPitch);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue