Pass around const to suppress a few compiler warnings.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
return (BoxPtr)(r->data + 1);
}
-static inline BoxPtr
+static inline const BoxRec *
region_rects(const RegionRec *r)
{
- return r->data ? region_boxptr(r) : (BoxPtr)&r->extents;
+ return r->data ? (const BoxRec *)(r->data + 1) : &r->extents;
}
#ifndef INCLUDE_LEGACY_REGION_DEFINES
PixmapPtr pixmap)
{
struct sna_pixmap *priv = sna_pixmap(pixmap);
- BoxPtr pbox = region_rects(dstRegion);
+ const BoxRec *pbox = region_rects(dstRegion);
int nbox = region_num_rects(dstRegion);
int dst_width = dstRegion->extents.x2 - dstRegion->extents.x1;
int dst_height = dstRegion->extents.y2 - dstRegion->extents.y1;
float src_offset_x, src_offset_y;
float src_scale_x, src_scale_y;
int nbox, pix_xoff, pix_yoff;
- BoxPtr box;
+ const BoxRec *box;
DBG(("%s: %dx%d -> %dx%d\n", __FUNCTION__,
src_width, src_height, dst_width, dst_height));
float src_offset_x, src_offset_y;
float src_scale_x, src_scale_y;
int nbox, pix_xoff, pix_yoff;
- BoxPtr box;
+ const BoxRec *box;
DBG(("%s: %dx%d -> %dx%d\n", __FUNCTION__,
src_width, src_height, dst_width, dst_height));
float src_scale_x, src_scale_y;
int nbox, pix_xoff, pix_yoff;
unsigned filter;
- BoxPtr box;
+ const BoxRec *box;
DBG(("%s: src=(%d, %d), dst=(%d, %d), %dx[(%d, %d), (%d, %d)...]\n",
__FUNCTION__,
float src_scale_x, src_scale_y;
int nbox, pix_xoff, pix_yoff;
unsigned filter;
- BoxPtr box;
+ const BoxRec *box;
DBG(("%s: src=(%d, %d), dst=(%d, %d), %dx[(%d, %d), (%d, %d)...]\n",
__FUNCTION__,
float src_scale_x, src_scale_y;
int nbox, pix_xoff, pix_yoff;
unsigned filter;
- BoxPtr box;
+ const BoxRec *box;
DBG(("%s: src=(%d, %d), dst=(%d, %d), %dx[(%d, %d), (%d, %d)...]\n",
__FUNCTION__,
}
if (priv->gpu_damage) {
- BoxPtr box;
+ const BoxRec *box;
int n;
DBG(("%s: flushing GPU damage\n", __FUNCTION__));
if (priv->clear) {
int n = region_num_rects(region);
- BoxPtr box = region_rects(region);
+ const BoxRec *box = region_rects(region);
assert(DAMAGE_IS_ALL(priv->gpu_damage));
assert(priv->cpu_damage == NULL);
*/
if (flags & MOVE_WRITE) {
int n = region_num_rects(region), i;
- BoxPtr boxes = region_rects(region);
+ const BoxRec *boxes = region_rects(region);
BoxPtr blocks;
blocks = NULL;
}
if (region_subsumes_damage(r, priv->gpu_damage)) {
- BoxPtr box;
+ const BoxRec *box;
int n;
DBG(("%s: region wholly contains damage\n",
bool ok = false;
int n;
- n = sna_damage_get_boxes(priv->cpu_damage, (BoxPtr *)&box);
+ n = sna_damage_get_boxes(priv->cpu_damage, &box);
assert(n);
if (use_cpu_bo_for_upload(sna, priv, 0)) {
DBG(("%s: using CPU bo for upload to GPU\n", __FUNCTION__));
{
struct sna *sna = to_sna_from_pixmap(pixmap);
struct sna_pixmap *priv;
- BoxPtr box;
+ const BoxRec *box;
int n;
DBG(("%s(pixmap=%ld, usage=%d), flags=%x\n",
{
struct sna *sna = to_sna_from_pixmap(pixmap);
struct sna_pixmap *priv = sna_pixmap(pixmap);
- BoxRec *box;
+ const BoxRec *box;
uint8_t *dst;
int n;
struct sna_pixmap *priv = sna_pixmap(pixmap);
bool ignore_cpu = false;
bool replaces;
- BoxRec *box;
+ const BoxRec *box;
uint8_t *dst;
int n;
{
PixmapPtr pixmap = get_drawable_pixmap(drawable);
unsigned int hint;
- BoxRec *box;
+ const BoxRec *box;
int16_t dx, dy;
int n;
struct sna *sna = to_sna_from_pixmap(pixmap);
struct sna_damage **damage;
struct kgem_bo *bo;
- BoxRec *box;
+ const BoxRec *box;
int16_t dx, dy;
int n;
uint8_t rop = copy_ROP[gc->alu];
}
}
-static BoxPtr
-reorder_boxes(BoxPtr box, int n, int dx, int dy)
+static const BoxRec *
+reorder_boxes(const BoxRec *box, int n, int dx, int dy)
{
- BoxPtr new, base, next, tmp;
+ const BoxRec *next, *base;
+ BoxRec *new;
DBG(("%s x %d dx=%d, dy=%d\n", __FUNCTION__, n, dx, dy));
if (dy <= 0 && dx <= 0) {
+ BoxRec *tmp;
+
new = malloc(sizeof(BoxRec) * n);
if (new == NULL)
return NULL;
base = next = box + n - 1;
while (base >= box) {
+ const BoxRec *tmp;
+
while (next >= box && base->y1 == next->y1)
next--;
tmp = next + 1;
base = next = box;
while (base < box + n) {
+ const BoxRec *tmp;
+
while (next < box + n && next->y1 == base->y1)
next++;
tmp = next;
PixmapPtr pixmap = get_drawable_pixmap(src);
struct sna *sna = to_sna_from_pixmap(pixmap);
struct sna_pixmap *priv = sna_pixmap(pixmap);
- BoxPtr box = region_rects(region);
+ const BoxRec *box = region_rects(region);
int n = region_num_rects(region);
int alu = gc ? gc->alu : GXcopy;
int16_t tx, ty, sx, sy;
free_boxes:
if (box != region_rects(region))
- free(box);
+ free((void *)box);
}
static inline bool
struct kgem_bo *bo;
int16_t src_dx, src_dy;
int16_t dst_dx, dst_dy;
- BoxPtr box = region_rects(region);
+ const BoxRec *box = region_rects(region);
int n = region_num_rects(region);
int alu = gc->alu;
int stride, bpp;
PixmapPtr bitmap = (PixmapPtr)_bitmap;
uint32_t br00, br13;
int16_t dx, dy;
- BoxPtr box;
+ const BoxRec *box;
int n;
DBG(("%s: plane=%x (%d,%d),(%d,%d)xld\n",
int16_t dx, dy;
int bit = ffs(bitplane) - 1;
uint32_t br00, br13;
- BoxPtr box = region_rects(region);
+ const BoxRec *box = region_rects(region);
int n = region_num_rects(region);
DBG(("%s: plane=%x [%d] x%d\n", __FUNCTION__,
} else {
while (n--) {
RegionRec region;
- BoxRec *box;
+ const BoxRec *box;
int nbox;
region.extents.x1 = rect->x + drawable->x;
struct sna *sna = to_sna_from_pixmap(pixmap);
struct sna_damage **damage;
struct kgem_bo *bo;
- BoxRec *box;
+ const BoxRec *box;
int16_t dx, dy;
int n;
uint8_t rop = copy_ROP[gc->alu];
xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
RegionRec region, *damage;
PixmapPtr src, dst;
- BoxPtr box;
+ const BoxRec *box;
int n;
assert(dirty->src == sna->front);
region->extents.x2 + sx <= src->pDrawable->width &&
region->extents.y2 + sy <= src->pDrawable->height) {
if (sigtrap_get() == 0) {
- BoxPtr box = region_rects(region);
+ const BoxRec *box = region_rects(region);
int nbox = region_num_rects(region);
sx += src->pDrawable->x;
if (sigtrap_get() == 0) {
if (op <= PictOpSrc) {
int nbox = region_num_rects(®ion);
- BoxPtr box = region_rects(®ion);
+ const BoxRec *box = region_rects(®ion);
uint32_t pixel;
if (op == PictOpClear)
}
#endif
-static int __sna_damage_get_boxes(struct sna_damage *damage, BoxPtr *boxes)
+static int __sna_damage_get_boxes(struct sna_damage *damage, const BoxRec **boxes)
{
assert(damage && damage->mode != DAMAGE_ALL);
}
#if HAS_DEBUG_FULL
-int _sna_damage_get_boxes(struct sna_damage *damage, BoxPtr *boxes)
+int _sna_damage_get_boxes(struct sna_damage *damage, const BoxRec **boxes)
{
char damage_buf[1000];
int count;
return count;
}
#else
-int _sna_damage_get_boxes(struct sna_damage *damage, BoxPtr *boxes)
+int _sna_damage_get_boxes(struct sna_damage *damage, const BoxRec **boxes)
{
return __sna_damage_get_boxes(damage, boxes);
}
return _sna_damage_contains_box__no_reduce(damage, box);
}
-int _sna_damage_get_boxes(struct sna_damage *damage, BoxPtr *boxes);
+int _sna_damage_get_boxes(struct sna_damage *damage, const BoxRec **boxes);
static inline int
-sna_damage_get_boxes(struct sna_damage *damage, BoxPtr *boxes)
+sna_damage_get_boxes(struct sna_damage *damage, const BoxRec **boxes)
{
assert(damage);
PictFormatPtr format;
PicturePtr src, dst;
PixmapPtr pixmap;
- BoxPtr b;
+ const BoxRec *b;
int n, depth, error;
DBG(("%s: compositing transformed damage boxes\n", __FUNCTION__));
struct kgem_bo *bo = NULL;
struct kgem_bo *src_bo;
struct kgem_bo *dst_bo;
- BoxRec *boxes;
+ const BoxRec *boxes;
int16_t dx, dy, sx, sy;
int w, h, n;
struct sna_composite_op tmp;
ScreenPtr screen = dst->pDrawable->pScreen;
PicturePtr glyph_atlas;
- BoxPtr rects;
+ const BoxRec *rects;
int nrect;
int16_t x, y;
struct sna_composite_op tmp;
ScreenPtr screen = dst->pDrawable->pScreen;
PicturePtr glyph_atlas = NO_ATLAS;
- BoxPtr rects;
+ const BoxRec *rects;
int nrect;
int x, y;
while (n--) {
GlyphPtr glyph = *glyphs++;
struct sna_glyph *p;
- BoxPtr rects;
+ const BoxRec *rects;
BoxRec box;
int nrect;
clip.extents.y2 - clip.extents.y1,
COMPOSITE_PARTIAL, memset(&tmp, 0, sizeof(tmp)))) {
unsigned int flags;
- pixman_box16_t *b;
+ const pixman_box16_t *b;
int i, count;
DBG(("%s: composite render op not supported\n",
__FUNCTION__, n));
do {
RegionRec clip;
- BoxPtr extents;
+ const BoxRec *extents;
int count;
clip.extents.x1 = pixman_fixed_to_int(t->left.p1.x);
do {
struct pixman_inplace pi;
RegionRec clip;
- BoxPtr extents;
+ const BoxRec *extents;
int count;
clip.extents.x1 = pixman_fixed_to_int(t->left.p1.x);
src_y -= pixman_fixed_to_int(t[0].left.p1.y);
do {
RegionRec clip;
- BoxPtr extents;
+ const BoxRec *extents;
int count;
int num_threads;