diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-09-17 21:38:46 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-09-17 22:33:28 +0100 |
commit | 7bcd1d2b75d280cecfc23877bb13426a28c07a1f (patch) | |
tree | ecbecf9cbdb421b07323e80e7423a2f76a3409d2 /src/sna | |
parent | a5b5b4ebb14cab19258dd1cbc12721aaa9df226d (diff) |
sna: perform a warnings reduction pass
Didn't spot anything that might have led to a genuine bug, but this
should help improve the signal-to-noise ratio of warnings in the future.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna')
-rw-r--r-- | src/sna/gen2_render.c | 39 | ||||
-rw-r--r-- | src/sna/gen3_render.c | 43 | ||||
-rw-r--r-- | src/sna/gen4_render.c | 30 | ||||
-rw-r--r-- | src/sna/gen5_render.c | 33 | ||||
-rw-r--r-- | src/sna/gen6_render.c | 42 | ||||
-rw-r--r-- | src/sna/gen7_render.c | 40 | ||||
-rw-r--r-- | src/sna/kgem.c | 42 | ||||
-rw-r--r-- | src/sna/kgem.h | 15 | ||||
-rw-r--r-- | src/sna/sna.h | 2 | ||||
-rw-r--r-- | src/sna/sna_accel.c | 4 | ||||
-rw-r--r-- | src/sna/sna_blt.c | 25 | ||||
-rw-r--r-- | src/sna/sna_composite.c | 12 | ||||
-rw-r--r-- | src/sna/sna_display.c | 18 | ||||
-rw-r--r-- | src/sna/sna_dri.c | 30 | ||||
-rw-r--r-- | src/sna/sna_glyphs.c | 15 | ||||
-rw-r--r-- | src/sna/sna_gradient.c | 7 | ||||
-rw-r--r-- | src/sna/sna_io.c | 6 | ||||
-rw-r--r-- | src/sna/sna_render.c | 25 | ||||
-rw-r--r-- | src/sna/sna_render.h | 3 | ||||
-rw-r--r-- | src/sna/sna_render_inline.h | 6 | ||||
-rw-r--r-- | src/sna/sna_tiling.c | 5 | ||||
-rw-r--r-- | src/sna/sna_trapezoids.c | 8 | ||||
-rw-r--r-- | src/sna/sna_video.c | 12 | ||||
-rw-r--r-- | src/sna/sna_video_textured.c | 1 |
24 files changed, 218 insertions, 245 deletions
diff --git a/src/sna/gen2_render.c b/src/sna/gen2_render.c index ce6dcedd..981f6af7 100644 --- a/src/sna/gen2_render.c +++ b/src/sna/gen2_render.c @@ -109,7 +109,7 @@ static const struct blendinfo { }; static const struct formatinfo { - int fmt; + unsigned int fmt; uint32_t card_fmt; } i8xx_tex_formats[] = { {PICT_a8, MAPSURF_8BIT | MT_8BIT_A8}, @@ -181,7 +181,7 @@ gen2_check_dst_format(uint32_t format) static uint32_t gen2_get_card_format(struct sna *sna, uint32_t format) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(i8xx_tex_formats); i++) if (i8xx_tex_formats[i].fmt == format) @@ -532,8 +532,7 @@ static void gen2_emit_invariant(struct sna *sna) } static void -gen2_get_batch(struct sna *sna, - const struct sna_composite_op *op) +gen2_get_batch(struct sna *sna) { kgem_set_mode(&sna->kgem, KGEM_RENDER); @@ -645,7 +644,7 @@ static void gen2_emit_composite_state(struct sna *sna, uint32_t cblend, ablend; int tex; - gen2_get_batch(sna, op); + gen2_get_batch(sna); gen2_emit_target(sna, op); OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | @@ -1068,7 +1067,7 @@ gen2_check_card_format(struct sna *sna, int x, int y, int w, int h) { uint32_t format = picture->format; - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(i8xx_tex_formats); i++) { if (i8xx_tex_formats[i].fmt == format) @@ -1168,8 +1167,7 @@ gen2_composite_picture(struct sna *sna, } static Bool -gen2_composite_set_target(struct sna *sna, - struct sna_composite_op *op, +gen2_composite_set_target(struct sna_composite_op *op, PicturePtr dst) { struct sna_pixmap *priv; @@ -1194,7 +1192,6 @@ gen2_composite_set_target(struct sna *sna, static Bool try_blt(struct sna *sna, - PicturePtr dst, PicturePtr source, int width, int height) { @@ -1239,7 +1236,7 @@ gen2_render_composite(struct sna *sna, * 3D -> 2D context switch. */ if (mask == NULL && - try_blt(sna, dst, src, width, height) && + try_blt(sna, src, width, height) && sna_blt_composite(sna, op, src, dst, src_x, src_y, @@ -1261,15 +1258,14 @@ gen2_render_composite(struct sna *sna, } if (need_tiling(sna, width, height)) - return sna_tiling_composite(sna, - op, src, mask, dst, + return sna_tiling_composite(op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height, tmp); - if (!gen2_composite_set_target(sna, tmp, dst)) { + if (!gen2_composite_set_target(tmp, dst)) { DBG(("%s: unable to set render target\n", __FUNCTION__)); return FALSE; @@ -1544,7 +1540,7 @@ gen2_emit_spans_pipeline(struct sna *sna, static void gen2_emit_composite_spans_state(struct sna *sna, const struct sna_composite_spans_op *op) { - gen2_get_batch(sna, &op->base); + gen2_get_batch(sna); gen2_emit_target(sna, &op->base); OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | @@ -1669,7 +1665,7 @@ gen2_render_composite_spans(struct sna *sna, if (need_tiling(sna, width, height)) return FALSE; - if (!gen2_composite_set_target(sna, &tmp->base, dst)) { + if (!gen2_composite_set_target(&tmp->base, dst)) { DBG(("%s: unable to set render target\n", __FUNCTION__)); return FALSE; @@ -1762,7 +1758,7 @@ static void gen2_emit_fill_composite_state(struct sna *sna, const struct sna_composite_op *op, uint32_t pixel) { - gen2_get_batch(sna, op); + gen2_get_batch(sna); gen2_emit_target(sna, op); OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | @@ -1914,7 +1910,7 @@ gen2_render_fill_boxes(struct sna *sna, static void gen2_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) { - gen2_get_batch(sna, op); + gen2_get_batch(sna); gen2_emit_target(sna, op); OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | @@ -2010,8 +2006,7 @@ gen2_render_fill(struct sna *sna, uint8_t alu, } static void -gen2_render_copy_setup_source(struct sna *sna, - struct sna_composite_channel *channel, +gen2_render_copy_setup_source(struct sna_composite_channel *channel, PixmapPtr pixmap, struct kgem_bo *bo) { @@ -2057,7 +2052,7 @@ gen2_emit_copy_pipeline(struct sna *sna, const struct sna_composite_op *op) static void gen2_emit_copy_state(struct sna *sna, const struct sna_composite_op *op) { - gen2_get_batch(sna, op); + gen2_get_batch(sna); gen2_emit_target(sna, op); OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | @@ -2143,7 +2138,7 @@ gen2_render_copy_boxes(struct sna *sna, uint8_t alu, tmp.floats_per_vertex = 4; - gen2_render_copy_setup_source(sna, &tmp.src, src, src_bo); + gen2_render_copy_setup_source(&tmp.src, src, src_bo); gen2_emit_copy_state(sna, &tmp); do { int n_this_time; @@ -2264,7 +2259,7 @@ gen2_render_copy(struct sna *sna, uint8_t alu, tmp->base.dst.format = sna_format_for_depth(dst->drawable.depth); tmp->base.dst.bo = dst_bo; - gen2_render_copy_setup_source(sna, &tmp->base.src, src, src_bo); + gen2_render_copy_setup_source(&tmp->base.src, src, src_bo); tmp->base.floats_per_vertex = 4; diff --git a/src/sna/gen3_render.c b/src/sna/gen3_render.c index 045178cf..2383e782 100644 --- a/src/sna/gen3_render.c +++ b/src/sna/gen3_render.c @@ -92,7 +92,7 @@ static const struct blendinfo { }; static const struct formatinfo { - int fmt, xfmt; + unsigned int fmt, xfmt; uint32_t card_fmt; Bool rb_reversed; } gen3_tex_formats[] = { @@ -1103,8 +1103,7 @@ static void gen3_emit_invariant(struct sna *sna) } static void -gen3_get_batch(struct sna *sna, - const struct sna_composite_op *op) +gen3_get_batch(struct sna *sna) { #define MAX_OBJECTS 3 /* worst case: dst + src + mask */ @@ -1185,10 +1184,10 @@ static void gen3_emit_composite_state(struct sna *sna, uint32_t map[4]; uint32_t sampler[4]; struct kgem_bo *bo[2]; - int tex_count, n; + unsigned int tex_count, n; uint32_t ss2; - gen3_get_batch(sna, op); + gen3_get_batch(sna); gen3_emit_target(sna, op->dst.bo, @@ -1659,7 +1658,7 @@ gen3_render_reset(struct sna *sna) static Bool gen3_composite_channel_set_format(struct sna_composite_channel *channel, CARD32 format) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(gen3_tex_formats); i++) { if (gen3_tex_formats[i].fmt == format) { @@ -1715,7 +1714,7 @@ static Bool gen3_composite_channel_set_xformat(PicturePtr picture, int x, int y, int width, int height) { - int i; + unsigned int i; if (PICT_FORMAT_A(picture->format) != 0) return FALSE; @@ -1739,9 +1738,7 @@ static Bool gen3_composite_channel_set_xformat(PicturePtr picture, } static int -gen3_init_solid(struct sna *sna, - struct sna_composite_channel *channel, - uint32_t color) +gen3_init_solid(struct sna_composite_channel *channel, uint32_t color) { channel->u.gen3.mode = color; channel->u.gen3.type = SHADER_CONSTANT; @@ -1943,8 +1940,7 @@ gen3_composite_picture(struct sna *sna, switch (source->type) { case SourcePictTypeSolidFill: - ret = gen3_init_solid(sna, channel, - source->solidFill.color); + ret = gen3_init_solid(channel, source->solidFill.color); break; case SourcePictTypeLinear: @@ -1965,7 +1961,7 @@ gen3_composite_picture(struct sna *sna, } if (sna_picture_is_solid(picture, &color)) - return gen3_init_solid(sna, channel, color); + return gen3_init_solid(channel, color); if (!gen3_check_repeat(picture->repeat)) return sna_render_picture_fixup(sna, picture, channel, @@ -2026,7 +2022,6 @@ picture_is_cpu(PicturePtr picture) static Bool try_blt(struct sna *sna, - PicturePtr dst, PicturePtr source, int width, int height) { @@ -2066,9 +2061,7 @@ gen3_align_vertex(struct sna *sna, } static Bool -gen3_composite_set_target(struct sna *sna, - struct sna_composite_op *op, - PicturePtr dst) +gen3_composite_set_target(struct sna_composite_op *op, PicturePtr dst) { struct sna_pixmap *priv; @@ -2136,7 +2129,7 @@ gen3_render_composite(struct sna *sna, * 3D -> 2D context switch. */ if (mask == NULL && - try_blt(sna, dst, src, width, height) && + try_blt(sna, src, width, height) && sna_blt_composite(sna, op, src, dst, src_x, src_y, @@ -2158,8 +2151,7 @@ gen3_render_composite(struct sna *sna, } if (need_tiling(sna, width, height)) - return sna_tiling_composite(sna, - op, src, mask, dst, + return sna_tiling_composite(op, src, mask, dst, src_x, src_y, mask_x, mask_y, dst_x, dst_y, @@ -2168,7 +2160,7 @@ gen3_render_composite(struct sna *sna, memset(&tmp->u.gen3, 0, sizeof(tmp->u.gen3)); - if (!gen3_composite_set_target(sna, tmp, dst)) { + if (!gen3_composite_set_target(tmp, dst)) { DBG(("%s: unable to set render target\n", __FUNCTION__)); return FALSE; @@ -2679,7 +2671,7 @@ gen3_render_composite_spans(struct sna *sna, if (need_tiling(sna, width, height)) return FALSE; - if (!gen3_composite_set_target(sna, &tmp->base, dst)) { + if (!gen3_composite_set_target(&tmp->base, dst)) { DBG(("%s: unable to set render target\n", __FUNCTION__)); return FALSE; @@ -3224,8 +3216,7 @@ gen3_render_video(struct sna *sna, } static void -gen3_render_copy_setup_source(struct sna *sna, - struct sna_composite_channel *channel, +gen3_render_copy_setup_source(struct sna_composite_channel *channel, PixmapPtr pixmap, struct kgem_bo *bo) { @@ -3309,7 +3300,7 @@ gen3_render_copy_boxes(struct sna *sna, uint8_t alu, tmp.dst.format = sna_format_for_depth(dst->drawable.depth); tmp.dst.bo = dst_bo; - gen3_render_copy_setup_source(sna, &tmp.src, src, src_bo); + gen3_render_copy_setup_source(&tmp.src, src, src_bo); tmp.floats_per_vertex = 4; tmp.mask.u.gen3.type = SHADER_NONE; @@ -3437,7 +3428,7 @@ gen3_render_copy(struct sna *sna, uint8_t alu, tmp->base.dst.format = sna_format_for_depth(dst->drawable.depth); tmp->base.dst.bo = dst_bo; - gen3_render_copy_setup_source(sna, &tmp->base.src, src, src_bo); + gen3_render_copy_setup_source(&tmp->base.src, src, src_bo); tmp->base.floats_per_vertex = 4; tmp->base.mask.u.gen3.type = SHADER_NONE; diff --git a/src/sna/gen4_render.c b/src/sna/gen4_render.c index d2b3746c..5d115a59 100644 --- a/src/sna/gen4_render.c +++ b/src/sna/gen4_render.c @@ -362,7 +362,7 @@ static void gen4_vertex_flush(struct sna *sna) static void gen4_vertex_finish(struct sna *sna, Bool last) { struct kgem_bo *bo; - int i, delta; + unsigned int i, delta; gen4_vertex_flush(sna); if (!sna->render.vertex_used) @@ -575,7 +575,7 @@ sampler_state_init(struct gen4_sampler_state *sampler_state, static uint32_t gen4_get_card_format(PictFormat format) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(gen4_tex_formats); i++) { if (gen4_tex_formats[i].pict_fmt == format) @@ -1110,7 +1110,6 @@ inline static int gen4_get_rectangles(struct sna *sna, } static uint32_t *gen4_composite_get_binding_table(struct sna *sna, - const struct sna_composite_op *op, uint16_t *offset) { sna->kgem.surface -= @@ -1409,7 +1408,7 @@ gen4_bind_surfaces(struct sna *sna, gen4_get_batch(sna); - binding_table = gen4_composite_get_binding_table(sna, op, &offset); + binding_table = gen4_composite_get_binding_table(sna, &offset); binding_table[0] = gen4_bind_bo(sna, @@ -1579,7 +1578,7 @@ static void gen4_video_bind_surfaces(struct sna *sna, gen4_get_batch(sna); - binding_table = gen4_composite_get_binding_table(sna, op, &offset); + binding_table = gen4_composite_get_binding_table(sna, &offset); binding_table[0] = gen4_bind_bo(sna, @@ -1781,7 +1780,7 @@ gen4_composite_picture(struct sna *sna, channel->transform = picture->transform; channel->card_format = gen4_get_card_format(picture->format); - if (channel->card_format == -1) + if (channel->card_format == (unsigned)-1) return sna_render_picture_convert(sna, picture, channel, pixmap, x, y, w, h, dst_x, dst_y); @@ -1797,7 +1796,7 @@ static void gen4_composite_channel_convert(struct sna_composite_channel *channel { channel->repeat = gen4_repeat(channel->repeat); channel->filter = gen4_filter(channel->filter); - if (channel->card_format == -1) + if (channel->card_format == (unsigned)-1) channel->card_format = gen4_get_card_format(channel->pict_format); } @@ -1820,9 +1819,7 @@ gen4_render_composite_done(struct sna *sna, } static Bool -gen4_composite_set_target(struct sna *sna, - PicturePtr dst, - struct sna_composite_op *op) +gen4_composite_set_target(PicturePtr dst, struct sna_composite_op *op) { struct sna_pixmap *priv; @@ -1869,6 +1866,7 @@ static inline bool prefer_blt(struct sna *sna) { #if PREFER_BLT return true; + (void)sna; #else return sna->kgem.mode != KGEM_RENDER; #endif @@ -1876,7 +1874,6 @@ static inline bool prefer_blt(struct sna *sna) static Bool try_blt(struct sna *sna, - PicturePtr dst, PicturePtr source, int width, int height) { @@ -1922,7 +1919,7 @@ gen4_render_composite(struct sna *sna, #endif if (mask == NULL && - try_blt(sna, dst, src, width, height) && + try_blt(sna, src, width, height) && sna_blt_composite(sna, op, src, dst, src_x, src_y, @@ -1934,15 +1931,14 @@ gen4_render_composite(struct sna *sna, return FALSE; if (need_tiling(sna, width, height)) - return sna_tiling_composite(sna, - op, src, mask, dst, + return sna_tiling_composite(op, src, mask, dst, src_x, src_y, msk_x, msk_y, dst_x, dst_y, width, height, tmp); - if (!gen4_composite_set_target(sna, dst, tmp)) + if (!gen4_composite_set_target(dst, tmp)) return FALSE; if (tmp->dst.width > 8192 || tmp->dst.height > 8192) { @@ -2095,7 +2091,7 @@ gen4_copy_bind_surfaces(struct sna *sna, const struct sna_composite_op *op) gen4_get_batch(sna); - binding_table = gen4_composite_get_binding_table(sna, op, &offset); + binding_table = gen4_composite_get_binding_table(sna, &offset); binding_table[0] = gen4_bind_bo(sna, @@ -2337,7 +2333,7 @@ gen4_fill_bind_surfaces(struct sna *sna, const struct sna_composite_op *op) gen4_get_batch(sna); - binding_table = gen4_composite_get_binding_table(sna, op, &offset); + binding_table = gen4_composite_get_binding_table(sna, &offset); binding_table[0] = gen4_bind_bo(sna, diff --git a/src/sna/gen5_render.c b/src/sna/gen5_render.c index d9edc2b2..b661a7e3 100644 --- a/src/sna/gen5_render.c +++ b/src/sna/gen5_render.c @@ -339,7 +339,7 @@ static void gen5_vertex_flush(struct sna *sna) static void gen5_vertex_finish(struct sna *sna, Bool last) { struct kgem_bo *bo; - int i, delta; + unsigned int i, delta; gen5_vertex_flush(sna); if (!sna->render.vertex_used) @@ -581,7 +581,7 @@ sampler_state_init(struct gen5_sampler_state *sampler_state, static uint32_t gen5_get_card_format(PictFormat format) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(gen5_tex_formats); i++) { if (gen5_tex_formats[i].pict_fmt == format) @@ -1121,7 +1121,6 @@ inline static int gen5_get_rectangles(struct sna *sna, static uint32_t * gen5_composite_get_binding_table(struct sna *sna, - const struct sna_composite_op *op, uint16_t *offset) { uint32_t *table; @@ -1429,7 +1428,7 @@ static void gen5_bind_surfaces(struct sna *sna, gen5_get_batch(sna); - binding_table = gen5_composite_get_binding_table(sna, op, &offset); + binding_table = gen5_composite_get_binding_table(sna, &offset); binding_table[0] = gen5_bind_bo(sna, @@ -1601,7 +1600,7 @@ static void gen5_video_bind_surfaces(struct sna *sna, } gen5_get_batch(sna); - binding_table = gen5_composite_get_binding_table(sna, op, &offset); + binding_table = gen5_composite_get_binding_table(sna, &offset); binding_table[0] = gen5_bind_bo(sna, @@ -1801,7 +1800,7 @@ gen5_composite_picture(struct sna *sna, channel->transform = picture->transform; channel->card_format = gen5_get_card_format(picture->format); - if (channel->card_format == -1) + if (channel->card_format == (unsigned)-1) return sna_render_picture_convert(sna, picture, channel, pixmap, x, y, w, h, dst_x, dst_y); @@ -1817,7 +1816,7 @@ static void gen5_composite_channel_convert(struct sna_composite_channel *channel { channel->repeat = gen5_repeat(channel->repeat); channel->filter = gen5_filter(channel->filter); - if (channel->card_format == -1) + if (channel->card_format == (unsigned)-1) channel->card_format = gen5_get_card_format(channel->pict_format); } @@ -1840,9 +1839,7 @@ gen5_render_composite_done(struct sna *sna, } static Bool -gen5_composite_set_target(struct sna *sna, - PicturePtr dst, - struct sna_composite_op *op) +gen5_composite_set_target(PicturePtr dst, struct sna_composite_op *op) { struct sna_pixmap *priv; @@ -1894,10 +1891,7 @@ picture_is_cpu(PicturePtr picture) } static Bool -try_blt(struct sna *sna, - PicturePtr dst, - PicturePtr source, - int width, int height) +try_blt(struct sna *sna, PicturePtr source, int width, int height) { if (sna->kgem.mode == KGEM_BLT) { DBG(("%s: already performing BLT\n", __FUNCTION__)); @@ -1930,7 +1924,7 @@ gen5_render_composite(struct sna *sna, width, height, sna->kgem.mode)); if (mask == NULL && - try_blt(sna, dst, src, width, height) && + try_blt(sna, src, width, height) && sna_blt_composite(sna, op, src, dst, src_x, src_y, @@ -1944,15 +1938,14 @@ gen5_render_composite(struct sna *sna, } if (need_tiling(sna, width, height)) - return sna_tiling_composite(sna, - op, src, mask, dst, + return sna_tiling_composite(op, src, mask, dst, src_x, src_y, msk_x, msk_y, dst_x, dst_y, width, height, tmp); - if (!gen5_composite_set_target(sna, dst, tmp)) { + if (!gen5_composite_set_target(dst, tmp)) { DBG(("%s: failed to set composite target\n", __FUNCTION__)); return FALSE; } @@ -2081,7 +2074,7 @@ gen5_copy_bind_surfaces(struct sna *sna, gen5_get_batch(sna); - binding_table = gen5_composite_get_binding_table(sna, op, &offset); + binding_table = gen5_composite_get_binding_table(sna, &offset); binding_table[0] = gen5_bind_bo(sna, @@ -2322,7 +2315,7 @@ gen5_fill_bind_surfaces(struct sna *sna, gen5_get_batch(sna); - binding_table = gen5_composite_get_binding_table(sna, op, &offset); + binding_table = gen5_composite_get_binding_table(sna, &offset); binding_table[0] = gen5_bind_bo(sna, diff --git a/src/sna/gen6_render.c b/src/sna/gen6_render.c index 03ddf758..91f59002 100644 --- a/src/sna/gen6_render.c +++ b/src/sna/gen6_render.c @@ -591,7 +591,7 @@ gen6_emit_cc(struct sna *sna, uint32_t blend_offset) OUT_BATCH(GEN6_3DSTATE_CC_STATE_POINTERS | (4 - 2)); OUT_BATCH((render->cc_blend + blend_offset) | 1); - if (render->blend == -1) { + if (render->blend == (unsigned)-1) { OUT_BATCH(1); OUT_BATCH(1); } else { @@ -662,7 +662,7 @@ gen6_emit_sf(struct sna *sna, Bool has_mask) } static void -gen6_emit_wm(struct sna *sna, int kernel, int nr_surfaces, int nr_inputs) +gen6_emit_wm(struct sna *sna, unsigned int kernel, int nr_surfaces, int nr_inputs) { if (sna->render_state.gen6.kernel == kernel) return; @@ -905,7 +905,7 @@ static void gen6_vertex_flush(struct sna *sna) static void gen6_vertex_finish(struct sna *sna, Bool last) { struct kgem_bo *bo; - int i, delta; + unsigned int i, delta; gen6_vertex_flush(sna); if (!sna->render.vertex_used) @@ -1035,7 +1035,7 @@ static uint32_t gen6_create_cc_viewport(struct sna_static_stream *stream) static uint32_t gen6_get_card_format(PictFormat format) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(gen6_tex_formats); i++) { if (gen6_tex_formats[i].pict_fmt == format) @@ -1510,7 +1510,6 @@ inline static int gen6_get_rectangles(struct sna *sna, } inline static uint32_t *gen6_composite_get_binding_table(struct sna *sna, - const struct sna_composite_op *op, uint16_t *offset) { uint32_t *table; @@ -1528,8 +1527,7 @@ inline static uint32_t *gen6_composite_get_binding_table(struct sna *sna, } static uint32_t -gen6_choose_composite_vertex_buffer(struct sna *sna, - const struct sna_composite_op *op) +gen6_choose_composite_vertex_buffer(const struct sna_composite_op *op) { int has_mask = op->mask.bo != NULL; int is_affine = op->is_affine; @@ -1560,7 +1558,7 @@ static void gen6_emit_composite_state(struct sna *sna, gen6_get_batch(sna); - binding_table = gen6_composite_get_binding_table(sna, op, &offset); + binding_table = gen6_composite_get_binding_table(sna, &offset); binding_table[0] = gen6_bind_bo(sna, @@ -1767,7 +1765,7 @@ static void gen6_emit_video_state(struct sna *sna, n_src = 1; } - binding_table = gen6_composite_get_binding_table(sna, op, &offset); + binding_table = gen6_composite_get_binding_table(sna, &offset); binding_table[0] = gen6_bind_bo(sna, @@ -1983,7 +1981,7 @@ gen6_composite_picture(struct sna *sna, channel->transform = picture->transform; channel->card_format = gen6_get_card_format(picture->format); - if (channel->card_format == -1) + if (channel->card_format == (unsigned)-1) return sna_render_picture_convert(sna, picture, channel, pixmap, x, y, w, h, dst_x, dst_y); @@ -2002,9 +2000,9 @@ static void gen6_composite_channel_convert(struct sna_composite_channel *channel { channel->repeat = gen6_repeat(channel->repeat); channel->filter = gen6_filter(channel->filter); - if (channel->card_format == -1) + if (channel->card_format == (unsigned)-1) channel->card_format = gen6_get_card_format(channel->pict_format); - assert(channel->card_format != -1); + assert(channel->card_format != (unsigned)-1); } static void gen6_render_composite_done(struct sna *sna, @@ -2023,9 +2021,7 @@ static void gen6_render_composite_done(struct sna *sna, } static Bool -gen6_composite_set_target(struct sna *sna, - struct sna_composite_op *op, - PicturePtr dst) +gen6_composite_set_target(struct sna_composite_op *op, PicturePtr dst) { struct sna_pixmap *priv; @@ -2070,7 +2066,7 @@ gen6_composite_set_target(struct sna *sna, } static Bool -try_blt(struct sna *sna, PicturePtr dst, int width, int height) +try_blt(struct sna *sna, int width, int height) { if (sna->kgem.mode == KGEM_BLT) { DBG(("%s: already performing BLT\n", __FUNCTION__)); @@ -2114,7 +2110,7 @@ gen6_render_composite(struct sna *sna, width, height, sna->kgem.mode)); if (mask == NULL && - try_blt(sna, dst, width, height) && + try_blt(sna, width, height) && sna_blt_composite(sna, op, src, dst, src_x, src_y, @@ -2126,8 +2122,7 @@ gen6_render_composite(struct sna *sna, return FALSE; if (need_tiling(sna, width, height)) - return sna_tiling_composite(sna, - op, src, mask, dst, + return sna_tiling_composite(op, src, mask, dst, src_x, src_y, msk_x, msk_y, dst_x, dst_y, @@ -2135,7 +2130,7 @@ gen6_render_composite(struct sna *sna, tmp); tmp->op = op; - if (!gen6_composite_set_target(sna, tmp, dst)) + if (!gen6_composite_set_target(tmp, dst)) return FALSE; if (tmp->dst.width > 8192 || tmp->dst.height > 8192) { @@ -2221,8 +2216,7 @@ gen6_render_composite(struct sna *sna, tmp->is_affine); tmp->u.gen6.nr_surfaces = 2 + (tmp->mask.bo != NULL); tmp->u.gen6.nr_inputs = 1 + (tmp->mask.bo != NULL); - tmp->u.gen6.ve_id = - gen6_choose_composite_vertex_buffer(sna, tmp); + tmp->u.gen6.ve_id = gen6_choose_composite_vertex_buffer(tmp); tmp->blt = gen6_render_composite_blt; tmp->boxes = gen6_render_composite_boxes; @@ -2262,7 +2256,7 @@ gen6_emit_copy_state(struct sna *sna, gen6_get_batch(sna); - binding_table = gen6_composite_get_binding_table(sna, op, &offset); + binding_table = gen6_composite_get_binding_table(sna, &offset); binding_table[0] = gen6_bind_bo(sna, @@ -2533,7 +2527,7 @@ gen6_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) gen6_get_batch(sna); - binding_table = gen6_composite_get_binding_table(sna, op, &offset); + binding_table = gen6_composite_get_binding_table(sna, &offset); binding_table[0] = gen6_bind_bo(sna, diff --git a/src/sna/gen7_render.c b/src/sna/gen7_render.c index c7906ca2..709b02ea 100644 --- a/src/sna/gen7_render.c +++ b/src/sna/gen7_render.c @@ -799,7 +799,7 @@ gen7_emit_sf(struct sna *sna, Bool has_mask) } static void -gen7_emit_wm(struct sna *sna, int kernel, int nr_surfaces, int nr_inputs) +gen7_emit_wm(struct sna *sna, unsigned int kernel, int nr_surfaces, int nr_inputs) { if (sna->render_state.gen7.kernel == kernel) return; @@ -1036,7 +1036,7 @@ static void gen7_vertex_flush(struct sna *sna) static void gen7_vertex_finish(struct sna *sna, Bool last) { struct kgem_bo *bo; - int i, delta; + unsigned int i, delta; gen7_vertex_flush(sna); if (!sna->render.vertex_used) @@ -1166,7 +1166,7 @@ static uint32_t gen7_create_cc_viewport(struct sna_static_stream *stream) static uint32_t gen7_get_card_format(PictFormat format) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(gen7_tex_formats); i++) { if (gen7_tex_formats[i].pict_fmt == format) @@ -1644,7 +1644,6 @@ inline static int gen7_get_rectangles(struct sna *sna, } inline static uint32_t *gen7_composite_get_binding_table(struct sna *sna, - const struct sna_composite_op *op, uint16_t *offset) { uint32_t *table; @@ -1662,8 +1661,7 @@ inline static uint32_t *gen7_composite_get_binding_table(struct sna *sna, } static uint32_t -gen7_choose_composite_vertex_buffer(struct sna *sna, - const struct sna_composite_op *op) +gen7_choose_composite_vertex_buffer(const struct sna_composite_op *op) { int has_mask = op->mask.bo != NULL; int is_affine = op->is_affine; @@ -1694,7 +1692,7 @@ static void gen7_emit_composite_state(struct sna *sna, gen7_get_batch(sna); - binding_table = gen7_composite_get_binding_table(sna, op, &offset); + binding_table = gen7_composite_get_binding_table(sna, &offset); binding_table[0] = gen7_bind_bo(sna, @@ -1899,7 +1897,7 @@ static void gen7_emit_video_state(struct sna *sna, n_src = 1; } - binding_table = gen7_composite_get_binding_table(sna, op, &offset); + binding_table = gen7_composite_get_binding_table(sna, &offset); binding_table[0] = gen7_bind_bo(sna, @@ -2115,7 +2113,7 @@ gen7_composite_picture(struct sna *sna, channel->transform = picture->transform; channel->card_format = gen7_get_card_format(picture->format); - if (channel->card_format == -1) + if (channel->card_format == (unsigned)-1) return sna_render_picture_convert(sna, picture, channel, pixmap, x, y, w, h, dst_x, dst_y); @@ -2135,9 +2133,9 @@ static void gen7_composite_channel_convert(struct sna_composite_channel *channel { channel->repeat = gen7_repeat(channel->repeat); channel->filter = gen7_filter(channel->filter); - if (channel->card_format == -1) + if (channel->card_format == (unsigned)-1) channel->card_format = gen7_get_card_format(channel->pict_format); - assert(channel->card_format != -1); + assert(channel->card_format != (unsigned)-1); } static void gen7_render_composite_done(struct sna *sna, @@ -2156,9 +2154,7 @@ static void gen7_render_composite_done(struct sna *sna, } static Bool -gen7_composite_set_target(struct sna *sna, - struct sna_composite_op *op, - PicturePtr dst) +gen7_composite_set_target(struct sna_composite_op *op, PicturePtr dst) { struct sna_pixmap *priv; @@ -2203,7 +2199,7 @@ gen7_composite_set_target(struct sna *sna, } static Bool -try_blt(struct sna *sna, PicturePtr dst, int width, int height) +try_blt(struct sna *sna, int width, int height) { if (sna->kgem.mode == KGEM_BLT) { DBG(("%s: already performing BLT\n", __FUNCTION__)); @@ -2247,7 +2243,7 @@ gen7_render_composite(struct sna *sna, width, height, sna->kgem.mode)); if (mask == NULL && - try_blt(sna, dst, width, height) && + try_blt(sna, width, height) && sna_blt_composite(sna, op, src, dst, src_x, src_y, @@ -2259,8 +2255,7 @@ gen7_render_composite(struct sna *sna, return FALSE; if (need_tiling(sna, width, height)) - return sna_tiling_composite(sna, - op, src, mask, dst, + return sna_tiling_composite(op, src, mask, dst, src_x, src_y, msk_x, msk_y, dst_x, dst_y, @@ -2268,7 +2263,7 @@ gen7_render_composite(struct sna *sna, tmp); tmp->op = op; - if (!gen7_composite_set_target(sna, tmp, dst)) + if (!gen7_composite_set_target(tmp, dst)) return FALSE; if (tmp->dst.width > GEN7_MAX_SIZE || tmp->dst.height > GEN7_MAX_SIZE) { @@ -2354,8 +2349,7 @@ gen7_render_composite(struct sna *sna, tmp->is_affine); tmp->u.gen7.nr_surfaces = 2 + (tmp->mask.bo != NULL); tmp->u.gen7.nr_inputs = 1 + (tmp->mask.bo != NULL); - tmp->u.gen7.ve_id = - gen7_choose_composite_vertex_buffer(sna, tmp); + tmp->u.gen7.ve_id = gen7_choose_composite_vertex_buffer(tmp); tmp->blt = gen7_render_composite_blt; tmp->boxes = gen7_render_composite_boxes; @@ -2395,7 +2389,7 @@ gen7_emit_copy_state(struct sna *sna, gen7_get_batch(sna); - binding_table = gen7_composite_get_binding_table(sna, op, &offset); + binding_table = gen7_composite_get_binding_table(sna, &offset); binding_table[0] = gen7_bind_bo(sna, @@ -2676,7 +2670,7 @@ gen7_emit_fill_state(struct sna *sna, const struct sna_composite_op *op) gen7_get_batch(sna); - binding_table = gen7_composite_get_binding_table(sna, op, &offset); + binding_table = gen7_composite_get_binding_table(sna, &offset); binding_table[0] = gen7_bind_bo(sna, diff --git a/src/sna/kgem.c b/src/sna/kgem.c index c13fabfb..e1549729 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -312,7 +312,8 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen) { drm_i915_getparam_t gp; struct drm_i915_gem_get_aperture aperture; - int i; + unsigned int i; + int v; memset(kgem, 0, sizeof(*kgem)); @@ -335,10 +336,10 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen) drm_i915_getparam_t gp; gp.param = I915_PARAM_HAS_VMAP; - gp.value = &i; + gp.value = &v; kgem->has_vmap = drmIoctl(kgem->fd, DRM_IOCTL_I915_GETPARAM, &gp) == 0 && - i > 0; + v > 0; } #endif DBG(("%s: using vmap=%d\n", __FUNCTION__, kgem->has_vmap)); @@ -348,9 +349,9 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen) drm_i915_getparam_t gp; gp.param = I915_PARAM_HAS_RELAXED_FENCING; - gp.value = &i; + gp.value = &v; if (drmIoctl(kgem->fd, DRM_IOCTL_I915_GETPARAM, &gp) == 0) - kgem->has_relaxed_fencing = i > 0; + kgem->has_relaxed_fencing = v > 0; } } else kgem->has_relaxed_fencing = 1; @@ -378,11 +379,11 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen) kgem->max_object_size = kgem->aperture_low; DBG(("%s: max object size %d\n", __FUNCTION__, kgem->max_object_size)); - i = 8; + v = 8; gp.param = I915_PARAM_NUM_FENCES_AVAIL; - gp.value = &i; + gp.value = &v; (void)drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp); - kgem->fence_max = i - 2; + kgem->fence_max = v - 2; DBG(("%s: max fences=%d\n", __FUNCTION__, kgem->fence_max)); } @@ -692,7 +693,7 @@ static void kgem_close_list(struct kgem *kgem, struct list *head) static void kgem_close_inactive(struct kgem *kgem) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(kgem->inactive); i++) kgem_close_list(kgem, &kgem->inactive[i]); @@ -1049,7 +1050,7 @@ bool kgem_expire_cache(struct kgem *kgem) struct kgem_bo *bo; unsigned int size = 0, count = 0; bool idle; - int i; + unsigned int i; kgem_retire(kgem); if (kgem->wedged) @@ -1118,7 +1119,7 @@ bool kgem_expire_cache(struct kgem *kgem) void kgem_cleanup_cache(struct kgem *kgem) { struct kgem_bo *bo; - int i; + unsigned int i; /* sync to the most recent request */ if (!list_is_empty(&kgem->requests)) { @@ -1155,7 +1156,7 @@ void kgem_cleanup_cache(struct kgem *kgem) } static struct kgem_bo * -search_linear_cache(struct kgem *kgem, int size, bool active) +search_linear_cache(struct kgem *kgem, unsigned int size, bool active) { struct kgem_bo *bo; struct list *cache; @@ -1360,7 +1361,7 @@ bool kgem_can_create_2d(struct kgem *kgem, static int kgem_bo_fenced_size(struct kgem *kgem, struct kgem_bo *bo) { - int size; + unsigned int size; assert(bo->tiling); assert(kgem->gen < 40); @@ -1772,6 +1773,10 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem, static uint32_t gem_vmap(int fd, void *ptr, int size, int read_only) { return 0; + (void)fd; + (void)ptr; + (void)size; + (void)read_only; } struct kgem_bo *kgem_create_map(struct kgem *kgem, @@ -1779,6 +1784,10 @@ struct kgem_bo *kgem_create_map(struct kgem *kgem, bool read_only) { return NULL; + (void)kgem; + (void)ptr; + (void)size; + (void)read_only; } #endif @@ -1954,10 +1963,11 @@ done: struct kgem_bo *kgem_upload_source_image(struct kgem *kgem, const void *data, - int x, int y, - int width, int height, + BoxPtr box, int stride, int bpp) { + int width = box->x2 - box->x1; + int height = box->y2 - box->y1; int dst_stride = ALIGN(width * bpp, 32) >> 3; int size = dst_stride * height; struct kgem_bo *bo; @@ -1972,7 +1982,7 @@ struct kgem_bo *kgem_upload_source_image(struct kgem *kgem, memcpy_blt(data, dst, bpp, stride, dst_stride, - x, y, + box->x1, box->y1, 0, 0, width, height); diff --git a/src/sna/kgem.h b/src/sna/kgem.h index 6f5035e5..43211f33 100644 --- a/src/sna/kgem.h +++ b/src/sna/kgem.h @@ -120,8 +120,8 @@ struct kgem { #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) #define KGEM_BATCH_SIZE(K) (ARRAY_SIZE((K)->batch)-KGEM_BATCH_RESERVED) -#define KGEM_EXEC_SIZE(K) (ARRAY_SIZE((K)->exec)-KGEM_EXEC_RESERVED) -#define KGEM_RELOC_SIZE(K) (ARRAY_SIZE((K)->reloc)-KGEM_RELOC_RESERVED) +#define KGEM_EXEC_SIZE(K) (int)(ARRAY_SIZE((K)->exec)-KGEM_EXEC_RESERVED) +#define KGEM_RELOC_SIZE(K) (int)(ARRAY_SIZE((K)->reloc)-KGEM_RELOC_RESERVED) void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen); void kgem_reset(struct kgem *kgem); @@ -138,8 +138,7 @@ struct kgem_bo *kgem_create_proxy(struct kgem_bo *target, struct kgem_bo *kgem_upload_source_image(struct kgem *kgem, const void *data, - int x, int y, - int width, int height, + BoxPtr box, int stride, int bpp); struct kgem_bo *kgem_upload_source_image_halved(struct kgem *kgem, pixman_format_code_t format, @@ -290,7 +289,7 @@ uint32_t kgem_bo_flink(struct kgem *kgem, struct kgem_bo *bo); Bool kgem_bo_write(struct kgem *kgem, struct kgem_bo *bo, const void *data, int length); -static inline bool kgem_bo_is_busy(struct kgem *kgem, struct kgem_bo *bo) +static inline bool kgem_bo_is_busy(struct kgem_bo *bo) { if (bo->exec) return true; @@ -332,7 +331,11 @@ void kgem_cleanup_cache(struct kgem *kgem); #if HAS_EXTRA_DEBUG void __kgem_batch_debug(struct kgem *kgem, uint32_t nbatch); #else -static inline void __kgem_batch_debug(struct kgem *kgem, uint32_t nbatch) {} +static inline void __kgem_batch_debug(struct kgem *kgem, uint32_t nbatch) +{ + (void)kgem; + (void)nbatch; +} #endif #endif /* KGEM_H */ diff --git a/src/sna/sna.h b/src/sna/sna.h index 4e0d710c..091fed5e 100644 --- a/src/sna/sna.h +++ b/src/sna/sna.h @@ -122,7 +122,7 @@ static inline void list_add_tail(struct list *new, struct list *head) #ifndef CREATE_PIXMAP_USAGE_SCRATCH_HEADER #define FAKE_CREATE_PIXMAP_USAGE_SCRATCH_HEADER 1 -#define CREATE_PIXMAP_USAGE_SCRATCH_HEADER -1 +#define CREATE_PIXMAP_USAGE_SCRATCH_HEADER (unsigned)-1 #endif #define SNA_CURSOR_X 64 diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c index 767453de..4463038d 100644 --- a/src/sna/sna_accel.c +++ b/src/sna/sna_accel.c @@ -105,7 +105,7 @@ static Bool sna_destroy_private(PixmapPtr pixmap, struct sna_pixmap *priv) if (priv->cpu_bo) { if (pixmap->usage_hint != CREATE_PIXMAP_USAGE_SCRATCH_HEADER && - kgem_bo_is_busy(&sna->kgem, priv->cpu_bo)) { + kgem_bo_is_busy(priv->cpu_bo)) { list_add_tail(&priv->list, &sna->deferred_free); return false; } @@ -913,7 +913,7 @@ static inline bool box_empty(const BoxRec *box) static Bool sna_put_image_upload_blt(DrawablePtr drawable, GCPtr gc, RegionPtr region, - int x, int y, int w, int h, char *bits, int stride) + int x, int y, int w, int h, char *bits, int stride) { struct sna *sna = to_sna_from_drawable(drawable); PixmapPtr pixmap = get_drawable_pixmap(drawable); diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c index e7a74aa1..5abfb026 100644 --- a/src/sna/sna_blt.c +++ b/src/sna/sna_blt.c @@ -94,6 +94,8 @@ static const uint8_t fill_ROP[] = { static void nop_done(struct sna *sna, const struct sna_composite_op *op) { + (void)sna; + (void)op; } static void blt_done(struct sna *sna, const struct sna_composite_op *op) @@ -102,6 +104,7 @@ static void blt_done(struct sna *sna, const struct sna_composite_op *op) DBG(("%s: nbatch=%d\n", __FUNCTION__, kgem->nbatch)); _kgem_set_mode(kgem, KGEM_BLT); + (void)op; } static bool sna_blt_fill_init(struct sna *sna, @@ -166,8 +169,8 @@ static void sna_blt_fill_one(struct sna *sna, if (kgem->nbatch >= 6 && blt->overwrites && kgem->batch[kgem->nbatch-6] == blt->cmd && - kgem->batch[kgem->nbatch-4] == (y << 16 | x) && - kgem->batch[kgem->nbatch-3] == ((y+height) << 16 | (x+width)) && + kgem->batch[kgem->nbatch-4] == ((uint32_t)y << 16 | (uint16_t)x) && + kgem->batch[kgem->nbatch-3] == ((uint32_t)(y+height) << 16 | (uint16_t)(x+width)) && kgem->reloc[kgem->nreloc-1].target_handle == blt->bo[0]->handle) { DBG(("%s: replacing last fill\n", __FUNCTION__)); kgem->batch[kgem->nbatch-5] = blt->br13; @@ -267,8 +270,8 @@ static void sna_blt_copy_one(struct sna *sna, if (kgem->nbatch >= 6 && blt->overwrites && kgem->batch[kgem->nbatch-6] == ((blt->cmd & ~XY_SRC_COPY_BLT_CMD) | XY_COLOR_BLT_CMD) && - kgem->batch[kgem->nbatch-4] == (dst_y << 16 | dst_x) && - kgem->batch[kgem->nbatch-3] == ((dst_y+height) << 16 | (dst_x+width)) && + kgem->batch[kgem->nbatch-4] == ((uint32_t)dst_y << 16 | (uint16_t)dst_x) && + kgem->batch[kgem->nbatch-3] == ((uint32_t)(dst_y+height) << 16 | (uint16_t)(dst_x+width)) && kgem->reloc[kgem->nreloc-1].target_handle == blt->bo[1]->handle) { DBG(("%s: replacing last fill\n", __FUNCTION__)); b = kgem->batch + kgem->nbatch - 6; @@ -528,7 +531,7 @@ sna_picture_is_solid(PicturePtr picture, uint32_t *color) static Bool pixel_is_opaque(uint32_t pixel, uint32_t format) { - int abits; + unsigned int abits; abits = PICT_FORMAT_A(format); if (!abits) @@ -536,11 +539,11 @@ pixel_is_opaque(uint32_t pixel, uint32_t format) if (PICT_FORMAT_TYPE(format) == PICT_TYPE_A || PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) { - return (pixel & ((1 << abits) - 1)) == ((1 << abits) - 1); + return (pixel & ((1 << abits) - 1)) == (unsigned)((1 << abits) - 1); } else if (PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB || PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) { - int ashift = PICT_FORMAT_BPP(format) - abits; - return (pixel >> ashift) == ((1 << abits) - 1); + unsigned int ashift = PICT_FORMAT_BPP(format) - abits; + return (pixel >> ashift) == (unsigned)((1 << abits) - 1); } else return FALSE; } @@ -1153,7 +1156,7 @@ Bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, const BoxRec *box, int nbox) { struct kgem *kgem = &sna->kgem; - int br13, cmd; + uint32_t br13, cmd; #if DEBUG_NO_BLT || NO_BLT_FILL_BOXES return FALSE; @@ -1195,8 +1198,8 @@ Bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu, if (kgem->nbatch >= 6 && (alu == GXcopy || alu == GXclear) && kgem->batch[kgem->nbatch-6] == cmd && - kgem->batch[kgem->nbatch-4] == (box[0].y1 << 16 | box[0].x1) && - kgem->batch[kgem->nbatch-3] == (box[0].y2 << 16 | box[0].x2) && + kgem->batch[kgem->nbatch-4] == ((uint32_t)box[0].y1 << 16 | (uint16_t)box[0].x1) && + kgem->batch[kgem->nbatch-3] == ((uint32_t)box[0].y2 << 16 | (uint16_t)box[0].x2) && kgem->reloc[kgem->nreloc-1].target_handle == bo->handle) { DBG(("%s: replacing last fill\n", __FUNCTION__)); kgem->batch[kgem->nbatch-5] = br13; diff --git a/src/sna/sna_composite.c b/src/sna/sna_composite.c index bda40c3e..200ab730 100644 --- a/src/sna/sna_composite.c +++ b/src/sna/sna_composite.c @@ -57,6 +57,9 @@ static void dst_move_area_to_cpu(PicturePtr picture, RegionIntersect(&area, &area, picture->pCompositeClip); sna_drawable_move_region_to_cpu(picture->pDrawable, &area, true); RegionUninit(&area); + + /* XXX use op to avoid a readback? */ + (void)op; } #define BOUND(v) (INT16) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) @@ -437,7 +440,7 @@ sna_composite(CARD8 op, goto fallback; } - if (too_small(sna, dst->pDrawable) && + if (too_small(dst->pDrawable) && !picture_is_gpu(src) && !picture_is_gpu(mask)) { DBG(("%s: fallback due to too small\n", __FUNCTION__)); goto fallback; @@ -508,13 +511,14 @@ static int16_t bound(int16_t a, uint16_t b) static Bool _pixman_region_init_clipped_rectangles(pixman_region16_t *region, - int num_rects, xRectangle *rects, + unsigned int num_rects, + xRectangle *rects, int tx, int ty, int maxx, int maxy) { pixman_box16_t stack_boxes[64], *boxes = stack_boxes; pixman_bool_t ret; - int i, j; + unsigned int i, j; if (num_rects > ARRAY_SIZE(stack_boxes)) { boxes = malloc(sizeof(pixman_box16_t) * num_rects); @@ -650,7 +654,7 @@ sna_composite_rectangles(CARD8 op, op = PictOpSrc; } - if (too_small(sna, dst->pDrawable)) { + if (too_small(dst->pDrawable)) { DBG(("%s: fallback, dst is too small\n", __FUNCTION__)); goto fallback; } diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 5aee1047..37fe7fd3 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -314,9 +314,7 @@ mode_from_kmode(ScrnInfoPtr scrn, } static void -mode_to_kmode(ScrnInfoPtr scrn, - drmModeModeInfoPtr kmode, - DisplayModePtr mode) +mode_to_kmode(drmModeModeInfoPtr kmode, DisplayModePtr mode) { memset(kmode, 0, sizeof(*kmode)); @@ -560,13 +558,13 @@ void sna_copy_fbcon(struct sna *sna) assert(priv && priv->gpu_bo); sx = dx = 0; - if (box.x2 < fbcon->width) + if (box.x2 < (uint16_t)fbcon->width) sx = (fbcon->width - box.x2) / 2.; if (box.x2 < sna->front->drawable.width) dx = (sna->front->drawable.width - box.x2) / 2.; sy = dy = 0; - if (box.y2 < fbcon->height) + if (box.y2 < (uint16_t)fbcon->height) sy = (fbcon->height - box.y2) / 2.; if (box.y2 < sna->front->drawable.height) dy = (sna->front->drawable.height - box.y2) / 2.; @@ -653,7 +651,7 @@ sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, kgem_submit(&sna->kgem); - mode_to_kmode(scrn, &sna_crtc->kmode, mode); + mode_to_kmode(&sna_crtc->kmode, mode); ret = sna_crtc_apply(crtc); if (!ret) { crtc->x = saved_x; @@ -1449,10 +1447,10 @@ static const char *output_names[] = { }; static bool -sna_zaphod_match(ScrnInfoPtr scrn, const char *s, const char *output) +sna_zaphod_match(const char *s, const char *output) { char t[20]; - int i = 0; + unsigned int i = 0; do { /* match any outputs in a comma list, stopping at whitespace */ @@ -1514,7 +1512,7 @@ sna_output_init(ScrnInfoPtr scrn, struct sna_mode *mode, int num) if (xf86IsEntityShared(scrn->entityList[0])) { s = xf86GetOptValString(sna->Options, OPTION_ZAPHOD); - if (s && !sna_zaphod_match(scrn, s, name)) + if (s && !sna_zaphod_match(s, name)) goto cleanup_encoder; } @@ -1832,7 +1830,7 @@ static const xf86CrtcConfigFuncsRec sna_crtc_config_funcs = { Bool sna_mode_pre_init(ScrnInfoPtr scrn, struct sna *sna) { struct sna_mode *mode = &sna->mode; - unsigned int i; + int i; list_init(&mode->crtcs); list_init(&mode->outputs); diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c index f4049f19..e9054477 100644 --- a/src/sna/sna_dri.c +++ b/src/sna/sna_dri.c @@ -339,7 +339,7 @@ static void sna_dri_reference_buffer(DRI2Buffer2Ptr buffer) private->refcnt++; } -static void damage(DrawablePtr drawable, PixmapPtr pixmap, RegionPtr region) +static void damage(PixmapPtr pixmap, RegionPtr region) { struct sna_pixmap *priv; BoxPtr box; @@ -508,7 +508,7 @@ sna_dri_copy(struct sna *sna, DrawablePtr draw, RegionPtr region, pixman_region_translate(region, dx, dy); DamageRegionAppend(&dst->drawable, region); DamageRegionProcessPending(&dst->drawable); - damage(draw, dst, region); + damage(dst, region); } if (region == &clip) @@ -716,9 +716,7 @@ sna_dri_frame_event_info_free(struct sna_dri_frame_event *info) } static void -sna_dri_exchange_buffers(DrawablePtr draw, - DRI2BufferPtr front, - DRI2BufferPtr back) +sna_dri_exchange_buffers(DRI2BufferPtr front, DRI2BufferPtr back) { int tmp; @@ -735,9 +733,7 @@ sna_dri_exchange_buffers(DrawablePtr draw, * flipping buffers as necessary. */ static Bool -sna_dri_schedule_flip(struct sna *sna, - DrawablePtr draw, - struct sna_dri_frame_event *info) +sna_dri_schedule_flip(struct sna *sna, struct sna_dri_frame_event *info) { struct sna_dri_private *back_priv; @@ -904,8 +900,8 @@ static void sna_dri_vblank_handle(int fd, case DRI2_FLIP: /* If we can still flip... */ if (can_flip(sna, draw, info->front, info->back) && - sna_dri_schedule_flip(sna, draw, info)) { - sna_dri_exchange_buffers(draw, info->front, info->back); + sna_dri_schedule_flip(sna, info)) { + sna_dri_exchange_buffers(info->front, info->back); return; } /* else fall through to exchange/blit */ @@ -958,7 +954,7 @@ sna_dri_flip(struct sna *sna, DrawablePtr draw, struct sna_dri_frame_event *info PixmapPtr pixmap; if (NO_TRIPPLE_BUFFER) - return sna_dri_schedule_flip(sna, draw, info); + return sna_dri_schedule_flip(sna, info); info->type = DRI2_FLIP_THROTTLE; @@ -970,7 +966,7 @@ sna_dri_flip(struct sna *sna, DrawablePtr draw, struct sna_dri_frame_event *info * take over. */ info->type = DRI2_FLIP; - return sna_dri_schedule_flip(sna, draw, info); + return sna_dri_schedule_flip(sna, info); } DBG(("%s: chaining flip\n", __FUNCTION__)); @@ -979,7 +975,7 @@ sna_dri_flip(struct sna *sna, DrawablePtr draw, struct sna_dri_frame_event *info return TRUE; } - if (!sna_dri_schedule_flip(sna, draw, info)) + if (!sna_dri_schedule_flip(sna, info)) return FALSE; info->old_front = @@ -995,7 +991,7 @@ sna_dri_flip(struct sna *sna, DrawablePtr draw, struct sna_dri_frame_event *info set_pixmap(sna, info->front, pixmap); } - sna_dri_exchange_buffers(draw, info->front, info->back); + sna_dri_exchange_buffers(info->front, info->back); DRI2SwapComplete(info->client, draw, 0, 0, 0, DRI2_EXCHANGE_COMPLETE, info->event_complete, @@ -1219,7 +1215,7 @@ sna_dri_schedule_swap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front, pixmap = sna_set_screen_pixmap(sna, back_priv->pixmap); assert(pixmap->refcnt > 1); pixmap->refcnt--; - sna_dri_exchange_buffers(draw, front, back); + sna_dri_exchange_buffers(front, back); DRI2SwapComplete(client, draw, 0, 0, 0, DRI2_EXCHANGE_COMPLETE, func, data); return TRUE; @@ -1486,7 +1482,7 @@ exchange: pixmap = sna_set_screen_pixmap(sna, back_priv->pixmap); screen->DestroyPixmap(pixmap); - sna_dri_exchange_buffers(draw, front, back); + sna_dri_exchange_buffers(front, back); DRI2SwapComplete(client, draw, 0, 0, 0, type, func, data); } #endif @@ -1684,7 +1680,7 @@ out_complete: } #endif -static int dri2_server_generation; +static unsigned int dri2_server_generation; Bool sna_dri_open(struct sna *sna, ScreenPtr screen) { diff --git a/src/sna/sna_glyphs.c b/src/sna/sna_glyphs.c index 720b3e47..709517f9 100644 --- a/src/sna/sna_glyphs.c +++ b/src/sna/sna_glyphs.c @@ -126,7 +126,7 @@ static inline struct sna_glyph *glyph_get_private(GlyphPtr glyph) static void unrealize_glyph_caches(struct sna *sna) { struct sna_render *render = &sna->render; - int i; + unsigned int i; DBG(("%s\n", __FUNCTION__)); @@ -157,7 +157,7 @@ static Bool realize_glyph_caches(struct sna *sna) PIXMAN_a8, PIXMAN_a8r8g8b8, }; - int i; + unsigned int i; DBG(("%s\n", __FUNCTION__)); @@ -842,6 +842,7 @@ Bool sna_glyphs_init(ScreenPtr screen) return FALSE; return TRUE; + (void)screen; } Bool sna_glyphs_create(struct sna *sna) @@ -883,17 +884,9 @@ glyphs_format(int nlist, GlyphListPtr list, GlyphPtr * glyphs) } x1 = x - glyph->info.x; - if (x1 < MINSHORT) - x1 = MINSHORT; y1 = y - glyph->info.y; - if (y1 < MINSHORT) - y1 = MINSHORT; x2 = x1 + glyph->info.width; - if (x2 > MAXSHORT) - x2 = MAXSHORT; y2 = y1 + glyph->info.height; - if (y2 > MAXSHORT) - y2 = MAXSHORT; if (first) { extents.x1 = x1; @@ -1131,7 +1124,7 @@ sna_glyphs(CARD8 op, goto fallback; } - if (too_small(sna, dst->pDrawable) && !picture_is_gpu(src)) { + if (too_small(dst->pDrawable) && !picture_is_gpu(src)) { DBG(("%s: fallback -- too small (%dx%d)\n", __FUNCTION__, dst->pDrawable->width, dst->pDrawable->height)); goto fallback; diff --git a/src/sna/sna_gradient.c b/src/sna/sna_gradient.c index a76f16e9..4a93143f 100644 --- a/src/sna/sna_gradient.c +++ b/src/sna/sna_gradient.c @@ -42,8 +42,7 @@ static int sna_gradient_sample_width(PictGradient *gradient) { - unsigned int n; - int width; + int n, width; width = 2; for (n = 1; n < gradient->nstops; n++) { @@ -102,7 +101,7 @@ sna_render_get_gradient(struct sna *sna, struct sna_gradient_cache *cache; pixman_image_t *gradient, *image; pixman_point_fixed_t p1, p2; - unsigned int i, width; + int i, width; struct kgem_bo *bo; DBG(("%s: %dx[%f:%x...%f:%x...%f:%x]\n", __FUNCTION__, @@ -258,7 +257,7 @@ struct kgem_bo * sna_render_get_solid(struct sna *sna, uint32_t color) { struct sna_solid_cache *cache = &sna->render.solid_cache; - unsigned int i; + int i; if ((color & 0xffffff) == 0) /* alpha only */ return kgem_bo_reference(sna->render.alpha_cache.bo[color>>24]); diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index c3904664..3207dc1b 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -93,7 +93,7 @@ void sna_read_boxes(struct sna *sna, dst->drawable.width, dst->drawable.height, dst_dx, dst_dy)); if (DEBUG_NO_IO || kgem->wedged || - !kgem_bo_is_busy(kgem, src_bo) || + !kgem_bo_is_busy(src_bo) || src_bo->tiling == I915_TILING_Y) { read_boxes_inplace(kgem, src_bo, src_dx, src_dy, @@ -285,7 +285,7 @@ void sna_write_boxes(struct sna *sna, DBG(("%s x %d\n", __FUNCTION__, nbox)); if (DEBUG_NO_IO || kgem->wedged || - !kgem_bo_is_busy(kgem, dst_bo) || + !kgem_bo_is_busy(dst_bo) || dst_bo->tiling == I915_TILING_Y) { write_boxes_inplace(kgem, src, stride, bpp, src_dx, src_dy, @@ -415,7 +415,7 @@ struct kgem_bo *sna_replace(struct sna *sna, __FUNCTION__, bo->handle, width, height, bpp, bo->tiling)); assert(bo->reusable); - if (kgem_bo_is_busy(kgem, bo)) { + if (kgem_bo_is_busy(bo)) { struct kgem_bo *new_bo; new_bo = kgem_create_2d(kgem, diff --git a/src/sna/sna_render.c b/src/sna/sna_render.c index dc740fc7..60e98441 100644 --- a/src/sna/sna_render.c +++ b/src/sna/sna_render.c @@ -83,6 +83,8 @@ no_render_composite(struct sna *sna, return TRUE; return FALSE; + (void)mask_x; + (void)mask_y; } static Bool @@ -179,21 +181,26 @@ no_render_fill(struct sna *sna, uint8_t alu, static void no_render_reset(struct sna *sna) { + (void)sna; } static void no_render_flush(struct sna *sna) { + (void)sna; } static void no_render_context_switch(struct kgem *kgem, int new_mode) { + (void)kgem; + (void)new_mode; } static void no_render_fini(struct sna *sna) { + (void)sna; } void no_render_init(struct sna *sna) @@ -299,7 +306,6 @@ texture_is_cpu(PixmapPtr pixmap, const BoxRec *box) static struct kgem_bo *upload(struct sna *sna, struct sna_composite_channel *channel, PixmapPtr pixmap, - int16_t x, int16_t y, int16_t w, int16_t h, BoxPtr box) { struct kgem_bo *bo; @@ -312,17 +318,16 @@ static struct kgem_bo *upload(struct sna *sna, assert(box->y2 <= pixmap->drawable.height); bo = kgem_upload_source_image(&sna->kgem, - pixmap->devPrivate.ptr, - box->x1, box->y1, w, h, + pixmap->devPrivate.ptr, box, pixmap->devKind, pixmap->drawable.bitsPerPixel); if (bo) { + channel->width = box->x2 - box->x1; + channel->height = box->y2 - box->y1; channel->offset[0] -= box->x1; channel->offset[1] -= box->y1; - channel->scale[0] = 1.f/w; - channel->scale[1] = 1.f/h; - channel->width = w; - channel->height = h; + channel->scale[0] = 1.f/channel->width; + channel->scale[1] = 1.f/channel->height; } return bo; @@ -414,7 +419,7 @@ sna_render_pixmap_bo(struct sna *sna, if (bo == NULL) { DBG(("%s: uploading CPU box (%d, %d), (%d, %d)\n", __FUNCTION__, box.x1, box.y1, box.x2, box.y2)); - bo = upload(sna, channel, pixmap, x,y, w,h, &box); + bo = upload(sna, channel, pixmap, &box); } } @@ -425,7 +430,7 @@ sna_render_pixmap_bo(struct sna *sna, } else { DBG(("%s: failed to upload pixmap to gpu, uploading CPU box (%d, %d), (%d, %d) instead\n", __FUNCTION__, box.x1, box.y1, box.x2, box.y2)); - bo = upload(sna, channel, pixmap, x,y, w,h, &box); + bo = upload(sna, channel, pixmap, &box); } } @@ -764,7 +769,7 @@ sna_render_picture_extract(struct sna *sna, if (texture_is_cpu(pixmap, &box) && !move_to_gpu(pixmap, &box)) { bo = kgem_upload_source_image(&sna->kgem, pixmap->devPrivate.ptr, - box.x1, box.y1, w, h, + &box, pixmap->devKind, pixmap->drawable.bitsPerPixel); if (!bo) { diff --git a/src/sna/sna_render.h b/src/sna/sna_render.h index 65e1f35d..80a9d00d 100644 --- a/src/sna/sna_render.h +++ b/src/sna/sna_render.h @@ -459,8 +459,7 @@ Bool gen5_render_init(struct sna *sna); Bool gen6_render_init(struct sna *sna); Bool gen7_render_init(struct sna *sna); -Bool sna_tiling_composite(struct sna *sna, - uint32_t op, +Bool sna_tiling_composite(uint32_t op, PicturePtr src, PicturePtr mask, PicturePtr dst, diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h index b09ad755..a2bee0c1 100644 --- a/src/sna/sna_render_inline.h +++ b/src/sna/sna_render_inline.h @@ -78,17 +78,17 @@ is_cpu(DrawablePtr drawable) } static inline Bool -is_dirty_gpu(struct sna *sna, DrawablePtr drawable) +is_dirty_gpu(DrawablePtr drawable) { struct sna_pixmap *priv = sna_pixmap_from_drawable(drawable); return priv && priv->gpu_bo && priv->gpu_damage; } static inline Bool -too_small(struct sna *sna, DrawablePtr drawable) +too_small(DrawablePtr drawable) { return (drawable->width * drawable->height <= 256) && - !is_dirty_gpu(sna, drawable); + !is_dirty_gpu(drawable); } static inline Bool diff --git a/src/sna/sna_tiling.c b/src/sna/sna_tiling.c index f69c3ef2..27b0fbfa 100644 --- a/src/sna/sna_tiling.c +++ b/src/sna/sna_tiling.c @@ -92,6 +92,7 @@ sna_tiling_composite_blt(struct sna *sna, const struct sna_composite_rectangles *r) { sna_tiling_composite_add_rect(op->u.priv, r); + (void)sna; } static void @@ -112,6 +113,7 @@ sna_tiling_composite_boxes(struct sna *sna, sna_tiling_composite_add_rect(op->u.priv, &r); box++; } + (void)sna; } static void @@ -212,8 +214,7 @@ static inline int split(int x, int y) } Bool -sna_tiling_composite(struct sna *sna, - uint32_t op, +sna_tiling_composite(uint32_t op, PicturePtr src, PicturePtr mask, PicturePtr dst, diff --git a/src/sna/sna_trapezoids.c b/src/sna/sna_trapezoids.c index 18376a08..bf2f8bc8 100644 --- a/src/sna/sna_trapezoids.c +++ b/src/sna/sna_trapezoids.c @@ -629,7 +629,7 @@ polygon_init(struct polygon *polygon, polygon->y_buckets = polygon->y_buckets_embedded; polygon->num_edges = 0; - if (num_edges > ARRAY_SIZE(polygon->edges_embedded)) { + if (num_edges > (int)ARRAY_SIZE(polygon->edges_embedded)) { polygon->edges = malloc(sizeof(struct edge)*num_edges); if (unlikely(NULL == polygon->edges)) goto bail_no_mem; @@ -1452,7 +1452,7 @@ mono_polygon_init (struct mono_polygon *polygon, BoxPtr box, int num_edges) polygon->num_edges = 0; polygon->edges = polygon->edges_embedded; - if (num_edges > ARRAY_SIZE (polygon->edges_embedded)) { + if (num_edges > (int)ARRAY_SIZE (polygon->edges_embedded)) { polygon->edges = malloc (num_edges * sizeof (struct mono_edge)); if (unlikely (polygon->edges == NULL)) { if (polygon->y_buckets != polygon->y_buckets_embedded) @@ -1943,7 +1943,7 @@ composite_aligned_boxes(CARD8 op, DBG(("%s\n", __FUNCTION__)); boxes = stack_boxes; - if (ntrap > ARRAY_SIZE(stack_boxes)) + if (ntrap > (int)ARRAY_SIZE(stack_boxes)) boxes = malloc(sizeof(BoxRec)*ntrap); dx = dst->pDrawable->x; @@ -2976,7 +2976,7 @@ sna_composite_trapezoids(CARD8 op, goto fallback; } - if (too_small(sna, dst->pDrawable) && !picture_is_gpu(src)) { + if (too_small(dst->pDrawable) && !picture_is_gpu(src)) { DBG(("%s: fallback -- dst is too small, %dx%d\n", __FUNCTION__, dst->pDrawable->width, diff --git a/src/sna/sna_video.c b/src/sna/sna_video.c index e50b3dd9..c8171dc5 100644 --- a/src/sna/sna_video.c +++ b/src/sna/sna_video.c @@ -79,7 +79,7 @@ static inline Bool sna_video_xvmc_setup(struct sna *sna, void sna_video_free_buffers(struct sna *sna, struct sna_video *video) { - int i; + unsigned int i; for (i = 0; i < ARRAY_SIZE(video->old_buf); i++) { if (video->old_buf[i]) { @@ -313,8 +313,7 @@ static void sna_memcpy_plane(unsigned char *dst, unsigned char *src, } static void -sna_copy_planar_data(struct sna *sna, - struct sna_video *video, +sna_copy_planar_data(struct sna_video *video, const struct sna_video_frame *frame, unsigned char *src, unsigned char *dst, @@ -365,8 +364,7 @@ sna_copy_planar_data(struct sna *sna, } static void -sna_copy_packed_data(struct sna *sna, - struct sna_video *video, +sna_copy_packed_data(struct sna_video *video, const struct sna_video_frame *frame, unsigned char *buf, unsigned char *dst, @@ -523,14 +521,14 @@ sna_video_copy_data(struct sna *sna, int srcPitch = ALIGN(frame->width, 0x4); int srcPitch2 = ALIGN((frame->width >> 1), 0x4); - sna_copy_planar_data(sna, video, frame, + sna_copy_planar_data(video, frame, buf, dst, srcPitch, srcPitch2, nlines, top, left); } else { int srcPitch = frame->width << 1; - sna_copy_packed_data(sna, video, frame, + sna_copy_packed_data(video, frame, buf, dst, srcPitch, top, left); diff --git a/src/sna/sna_video_textured.c b/src/sna/sna_video_textured.c index 3b59cf23..6ff08689 100644 --- a/src/sna/sna_video_textured.c +++ b/src/sna/sna_video_textured.c @@ -121,6 +121,7 @@ static int xvmc_passthrough(int id) return id == FOURCC_XVMC; #else return 0; + (void)id; #endif } |