Skip to contentSkip to conversation

Compiler warn elimination

PATCH In review Ville Syrjala 2 participants 23 messages Sep 19, 2019 – Sep 27, 2019 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover Compiler warn elimination

From: Ville Syrjälä <[email protected]>

Random smattering of patches to eliminate compiler warnings. Some I just suppressed out of lazyness, others I tried to silence by adjusting the code a bit.

Afterwards the build is clean on my gcc 8.3, though with a bunch of stuff still suppressed I'm not 100% sure that's a good thing.

git://github.com/vsyrjala/xf86-video-intel.git compiler_warns_3

Ville Syrjälä (21):
sna: Use -Wno-clobbered
sna: Shut up more compiler warns
sna: undef FontSetPrivate() before redefining it
sna: Replace fall through comments with standard form
sna: Annotate more fall throughs
sna: Add sna_br13_color_depth()
sna/fb: Eliminate implicit fallthrough
uxa: Use named initializers
Avoid missing initializer warning
sna: Use named initializers
sna: Increase the size of the path name buffer a bit
sna: Use memcmp() to avoid strict aliasing warns
sna: Avoid strict aliasing violations with glyphinfo sna/fb: Use memcpy() to avoid strict aliasing violations
xvmc: Eliminate strict aliasing violations sna/fb: Initialize xoff/yoff
sna: Use -Wno-maybe-uninitialized
sna: Get rid of -Wno-shift-negative-value
uxa: Get rid of -Wno-shift-negative-value
tools: Get rid of -Wno-sign-compare
sna: Fix compiler warnings due to DrawablePtr vs. PixmapPtr

 src/intel_device.c              |  2 +-
 src/intel_module.c              |  3 +-
 src/legacy/i810/xvmc/I810XvMC.c | 48 ++++++++++++++--------------
 src/meson.build                 |  1 -
 src/sna/blt.c                   |  2 ++
 src/sna/fb/fb.h                 |  6 ++--
 src/sna/fb/fbpict.c             |  6 +++-
 src/sna/fb/fbspan.c             |  6 ++--
 src/sna/gen2_render.c           | 21 ++++++++++---
 src/sna/gen3_render.c           | 24 ++++++++++----
 src/sna/gen4_render.c           |  6 ++--
 src/sna/gen5_render.c           |  6 ++--
 src/sna/gen6_render.c           |  6 ++--
 src/sna/gen7_render.c           |  6 ++--
 src/sna/gen8_render.c           |  6 ++--
 src/sna/gen9_render.c           |  6 ++--
 src/sna/kgem.c                  | 10 ++----
 src/sna/meson.build             |  7 +++--
 src/sna/sna.h                   | 19 +++++++++++
 src/sna/sna_accel.c             | 24 +++++++++++++-
 src/sna/sna_blt.c               | 56 +++++++--------------------------
 src/sna/sna_composite.c         |  2 +-
 src/sna/sna_damage.h            |  1 +
 src/sna/sna_display.c           | 15 ++++-----
 src/sna/sna_display_fake.c      |  2 +-
 src/sna/sna_dri2.c              |  6 ++--
 src/sna/sna_driver.c            |  1 +
 src/sna/sna_glyphs.c            |  7 +++--
 src/sna/sna_io.c                | 30 ++++++------------
 src/sna/sna_render.c            |  4 +--
 src/sna/sna_render.h            |  2 +-
 src/sna/sna_trapezoids_mono.c   |  2 +-
 src/sna/sna_video_overlay.c     |  6 +++-
 src/sna/sna_video_sprite.c      |  8 ++++-
 src/sna/sna_video_textured.c    |  5 ++-
 src/uxa/i965_render.c           |  2 +-
 src/uxa/i965_video.c            |  2 +-
 src/uxa/intel_display.c         |  2 +-
 src/uxa/intel_dri.c             |  1 +
 src/uxa/meson.build             |  1 -
 tools/backlight_helper.c        |  2 +-
 tools/meson.build               |  2 --
 tools/virtual.c                 | 18 +++++------
 43 files changed, 221 insertions(+), 171 deletions(-)
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/21 sna: Use -Wno-clobbered

From: Ville Syrjälä <[email protected]>

../src/sna/sna_composite.c:567:11: warning: variable ‘sx’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]

   int16_t sx = src_x + tx - (dst->pDrawable->x + dst_x);
           ^~

etc.

I had a quick look at a few of the cases and they seemed fine to me, so feels like gcc just being dense.

---
 src/sna/meson.build | 1 +
 1 file changed, 1 insertion(+)
src/sna/meson.build +1 -0
index 5631d4d8047f..4af181f37b29 100644
@@ -135,5 +135,6 @@ sna = static_library('sna',
 		       '-Wno-unused-parameter',
 		       '-Wno-sign-compare',
 		       '-Wno-type-limits',
+		       '-Wno-clobbered',
 		     ],
 		     install : false)
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 2/21 sna: Shut up more compiler warns

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Suppress more compiler warnings.

---
 src/sna/meson.build | 3 +++
 1 file changed, 3 insertions(+)
src/sna/meson.build +3 -0
index 4af181f37b29..b1276ab3aa6e 100644
@@ -131,8 +131,11 @@ sna = static_library('sna',
 		     c_args : [
 		       '-Wno-missing-field-initializers',
 		       '-Wno-unused-but-set-variable',
+		       '-Wno-expansion-to-defined',
 		       '-Wno-shift-negative-value',
 		       '-Wno-unused-parameter',
+		       '-Wno-unused-function',
+		       '-Wno-unused-variable',
 		       '-Wno-sign-compare',
 		       '-Wno-type-limits',
 		       '-Wno-clobbered',
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

PATCH 3/21 sna: undef FontSetPrivate() before redefining it

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Avoid the compiler gettings upset about us redefining FontSetPrivate().

---
 src/sna/sna_accel.c | 1 +
 1 file changed, 1 insertion(+)
src/sna/sna_accel.c +1 -0
index 7fd00b9af679..934c8f662bea 100644
@@ -121,6 +121,7 @@
 
 #if XFONT2_CLIENT_FUNCS_VERSION >= 1
 #define AllocateFontPrivateIndex() xfont2_allocate_font_private_index()
+#undef FontSetPrivate
 #define FontSetPrivate(font, idx, data) xfont2_font_set_private(font, idx, data)
 #endif
 
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 4/21 sna: Replace fall through comments with standard form

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

gcc doesn't like extra stuff in the fall through comments. Replace them with the standard form.

---
 src/sna/gen4_render.c | 6 +++---
 src/sna/gen5_render.c | 6 +++---
 src/sna/gen6_render.c | 6 +++---
 src/sna/gen7_render.c | 6 +++---
 src/sna/gen8_render.c | 6 +++---
 src/sna/gen9_render.c | 6 +++---
 src/sna/sna_dri2.c    | 4 ++--
 src/sna/sna_render.h  | 2 +-
 8 files changed, 21 insertions(+), 21 deletions(-)
src/sna/gen4_render.c +3 -3
index ae26debf049a..5a4f968d0268 100644
@@ -2019,7 +2019,7 @@ gen4_render_composite(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		if (mask == NULL &&
 		    sna_blt_composite__convert(sna,
@@ -2071,7 +2071,7 @@ gen4_render_composite(struct sna *sna,
 			case 0:
 				if (!gen4_channel_init_solid(sna, &tmp->mask, 0))
 					goto cleanup_src;
-				/* fall through to fixup */
+				/* fall through */
 			case 1:
 				gen4_composite_channel_convert(&tmp->mask);
 				break;
@@ -2328,7 +2328,7 @@ gen4_render_composite_spans(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->base.src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		gen4_composite_channel_convert(&tmp->base.src);
 		break;
src/sna/gen5_render.c +3 -3
index 3d9d35f113aa..3b1f25aacb39 100644
@@ -1972,7 +1972,7 @@ gen5_render_composite(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		if (mask == NULL &&
 		    sna_blt_composite__convert(sna,
@@ -2023,7 +2023,7 @@ gen5_render_composite(struct sna *sna,
 			case 0:
 				if (!gen4_channel_init_solid(sna, &tmp->mask, 0))
 					goto cleanup_src;
-				/* fall through to fixup */
+				/* fall through */
 			case 1:
 				gen5_composite_channel_convert(&tmp->mask);
 				break;
@@ -2268,7 +2268,7 @@ gen5_render_composite_spans(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->base.src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		gen5_composite_channel_convert(&tmp->base.src);
 		break;
src/sna/gen6_render.c +3 -3
index 9eefcbda3e26..1a64d5b915e3 100644
@@ -2346,7 +2346,7 @@ gen6_render_composite(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		/* Did we just switch rings to prepare the source? */
 		if (mask == NULL &&
@@ -2399,7 +2399,7 @@ gen6_render_composite(struct sna *sna,
 			case 0:
 				if (!gen4_channel_init_solid(sna, &tmp->mask, 0))
 					goto cleanup_src;
-				/* fall through to fixup */
+				/* fall through */
 			case 1:
 				gen6_composite_channel_convert(&tmp->mask);
 				break;
@@ -2653,7 +2653,7 @@ gen6_render_composite_spans(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->base.src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		gen6_composite_channel_convert(&tmp->base.src);
 		break;
src/sna/gen7_render.c +3 -3
index a33ba902d665..f58f39d457dc 100644
@@ -2576,7 +2576,7 @@ gen7_render_composite(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		/* Did we just switch rings to prepare the source? */
 		if (mask == NULL &&
@@ -2629,7 +2629,7 @@ gen7_render_composite(struct sna *sna,
 			case 0:
 				if (!gen4_channel_init_solid(sna, &tmp->mask, 0))
 					goto cleanup_src;
-				/* fall through to fixup */
+				/* fall through */
 			case 1:
 				gen7_composite_channel_convert(&tmp->mask);
 				break;
@@ -2863,7 +2863,7 @@ gen7_render_composite_spans(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->base.src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		gen7_composite_channel_convert(&tmp->base.src);
 		break;
src/sna/gen8_render.c +3 -3
index 5d09c2cca94f..0955f90e0c37 100644
@@ -2405,7 +2405,7 @@ gen8_render_composite(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		/* Did we just switch rings to prepare the source? */
 		if (mask == NULL &&
@@ -2461,7 +2461,7 @@ gen8_render_composite(struct sna *sna,
 			case 0:
 				if (!gen4_channel_init_solid(sna, &tmp->mask, 0))
 					goto cleanup_src;
-				/* fall through to fixup */
+				/* fall through */
 			case 1:
 				if (!gen8_composite_channel_convert(&tmp->mask))
 					goto cleanup_mask;
@@ -2696,7 +2696,7 @@ gen8_render_composite_spans(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->base.src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		if (!gen8_composite_channel_convert(&tmp->base.src))
 			goto cleanup_src;
src/sna/gen9_render.c +3 -3
index 469084990264..06c1f9a32145 100644
@@ -2483,7 +2483,7 @@ gen9_render_composite(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		/* Did we just switch rings to prepare the source? */
 		if (mask == NULL &&
@@ -2539,7 +2539,7 @@ gen9_render_composite(struct sna *sna,
 			case 0:
 				if (!gen4_channel_init_solid(sna, &tmp->mask, 0))
 					goto cleanup_src;
-				/* fall through to fixup */
+				/* fall through */
 			case 1:
 				if (!gen9_composite_channel_convert(&tmp->mask))
 					goto cleanup_mask;
@@ -2774,7 +2774,7 @@ gen9_render_composite_spans(struct sna *sna,
 	case 0:
 		if (!gen4_channel_init_solid(sna, &tmp->base.src, 0))
 			goto cleanup_dst;
-		/* fall through to fixup */
+		/* fall through */
 	case 1:
 		if (!gen9_composite_channel_convert(&tmp->base.src))
 			goto cleanup_src;
src/sna/sna_dri2.c +2 -2
index 6426a38626af..daa71dc6db30 100644
@@ -2601,7 +2601,7 @@ void sna_dri2_vblank_handler(struct drm_event_vblank *event)
 		    sna_dri2_flip(info))
 			return;
 
-		/* else fall through to blit */
+		/* fall through */
 	case SWAP:
 		assert(info->signal);
 		if (can_xchg(info->sna, draw, info->front, info->back)) {
@@ -2623,7 +2623,7 @@ void sna_dri2_vblank_handler(struct drm_event_vblank *event)
 		DBG(("%s -- requeue failed, errno=%d\n", __FUNCTION__, errno));
 		assert(info->pending.bo == NULL);
 		assert(info->keepalive == 1);
-		/* fall through to SwapComplete */
+		/* fall through */
 	case SWAP_COMPLETE:
 		DBG(("%s: %d complete, frame=%d tv=%d.%06d\n",
 		     __FUNCTION__, info->type,
src/sna/sna_render.h +1 -1
index 891fc905fad2..7599803211fc 100644
@@ -823,7 +823,7 @@ sna_get_pixel_from_rgba(uint32_t * pixel,
 	switch (format) {
 	case PICT_x8r8g8b8:
 		alpha = 0xffff;
-		/* fall through to re-use a8r8g8b8 expansion */
+		/* fall through */
 	case PICT_a8r8g8b8:
 		*pixel = ((alpha >> 8 << 24) |
 			  (red >> 8 << 16) |
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 5/21 sna: Annotate more fall throughs

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Sprinkle fall through comments where needed.

---
 src/intel_module.c    |  1 +
 src/sna/blt.c         |  2 ++
 src/sna/gen2_render.c | 21 +++++++++++++++++----
 src/sna/gen3_render.c | 24 ++++++++++++++++++------
 src/sna/sna_accel.c   |  3 +++
 src/sna/sna_damage.h  |  1 +
 src/sna/sna_display.c |  7 ++++---
 src/sna/sna_dri2.c    |  2 ++
 src/sna/sna_driver.c  |  1 +
 src/sna/sna_render.c  |  4 ++--
 src/uxa/intel_dri.c   |  1 +
 11 files changed, 52 insertions(+), 15 deletions(-)
src/intel_module.c +1 -0
index a8c9768ee9f8..171b20d83d33 100644
@@ -692,6 +692,7 @@ static Bool intel_pci_probe(DriverPtr		driver,
 		case PCI_CHIP_I815:
 			if (!hosted())
 				break;
+			/* fall through */
 		default:
 			return FALSE;
 		}
src/sna/blt.c +2 -0
index cb90437ad5ad..afc719f6dc8c 100644
@@ -1404,6 +1404,7 @@ memcpy_xor(const void *src, void *dst, int bpp,
 				width /= 2;
 				or |= or << 8;
 			}
+			/* fall through */
 		case 2:
 			if (width & 1) {
 				do {
@@ -1421,6 +1422,7 @@ memcpy_xor(const void *src, void *dst, int bpp,
 				width /= 2;
 				or |= or << 16;
 			}
+			/* fall through */
 		case 4:
 			w = width;
 			if (w * 4 == dst_stride && dst_stride == src_stride) {
src/sna/gen2_render.c +17 -4
index e03c44015701..80f684543149 100644
@@ -116,10 +116,17 @@ gen2_buf_tiling(uint32_t tiling)
 {
 	uint32_t v = 0;
 	switch (tiling) {
-	default: assert(0);
-	case I915_TILING_Y: v |= BUF_3D_TILE_WALK_Y;
-	case I915_TILING_X: v |= BUF_3D_TILED_SURFACE;
-	case I915_TILING_NONE: break;
+	default:
+		assert(0);
+		/* fall through */
+	case I915_TILING_Y:
+		v |= BUF_3D_TILE_WALK_Y;
+		/* fall through */
+	case I915_TILING_X:
+		v |= BUF_3D_TILED_SURFACE;
+		/* fall through */
+	case I915_TILING_NONE:
+		break;
 	}
 	return v;
 }
@@ -131,6 +138,7 @@ gen2_get_dst_format(uint32_t format)
 	switch (format) {
 	default:
 		assert(0);
+		/* fall through */
 	case PICT_a8r8g8b8:
 	case PICT_x8r8g8b8:
 		return COLR_BUF_ARGB8888 | BIAS;
@@ -219,10 +227,13 @@ gen2_sampler_tiling_bits(uint32_t tiling)
 	switch (tiling) {
 	default:
 		assert(0);
+		/* fall through */
 	case I915_TILING_Y:
 		bits |= TM0S1_TILE_WALK;
+		/* fall through */
 	case I915_TILING_X:
 		bits |= TM0S1_TILED_SURFACE;
+		/* fall through */
 	case I915_TILING_NONE:
 		break;
 	}
@@ -277,6 +288,7 @@ gen2_emit_texture(struct sna *sna,
 	switch (channel->repeat) {
 	default:
 		assert(0);
+		/* fall through */
 	case RepeatNone:
 		wrap_mode_u = TEXCOORDMODE_CLAMP_BORDER;
 		break;
@@ -298,6 +310,7 @@ gen2_emit_texture(struct sna *sna,
 	switch (channel->filter) {
 	default:
 		assert(0);
+		/* fall through */
 	case PictFilterNearest:
 		filter = (FILTER_NEAREST << TM0S3_MAG_FILTER_SHIFT |
 			  FILTER_NEAREST << TM0S3_MIN_FILTER_SHIFT |
src/sna/gen3_render.c +18 -6
index 166635eba055..e0a7d158015a 100644
@@ -131,9 +131,14 @@ static inline uint32_t gen3_buf_tiling(uint32_t tiling)
 {
 	uint32_t v = 0;
 	switch (tiling) {
-	case I915_TILING_Y: v |= BUF_3D_TILE_WALK_Y;
-	case I915_TILING_X: v |= BUF_3D_TILED_SURFACE;
-	case I915_TILING_NONE: break;
+	case I915_TILING_Y:
+		v |= BUF_3D_TILE_WALK_Y;
+		/* fall through */
+	case I915_TILING_X:
+		v |= BUF_3D_TILED_SURFACE;
+		/* fall through */
+	case I915_TILING_NONE:
+		break;
 	}
 	return v;
 }
@@ -400,6 +405,7 @@ static uint32_t gen3_filter(uint32_t filter)
 	switch (filter) {
 	default:
 		assert(0);
+		/* fall through */
 	case PictFilterNearest:
 		return (FILTER_NEAREST << SS2_MAG_FILTER_SHIFT |
 			FILTER_NEAREST << SS2_MIN_FILTER_SHIFT |
@@ -1884,9 +1890,14 @@ static uint32_t gen3_ms_tiling(uint32_t tiling)
 {
 	uint32_t v = 0;
 	switch (tiling) {
-	case I915_TILING_Y: v |= MS3_TILE_WALK;
-	case I915_TILING_X: v |= MS3_TILED_SURFACE;
-	case I915_TILING_NONE: break;
+	case I915_TILING_Y:
+		v |= MS3_TILE_WALK;
+		/* fall through */
+	case I915_TILING_X:
+		v |= MS3_TILED_SURFACE;
+		/* fall through */
+	case I915_TILING_NONE:
+		break;
 	}
 	return v;
 }
@@ -4981,6 +4992,7 @@ gen3_render_composite_spans(struct sna *sna,
 	switch (tmp->base.src.u.gen3.type) {
 	case SHADER_NONE:
 		assert(0);
+		/* fall through */
 	case SHADER_ZERO:
 		if (no_offset) {
 			tmp->prim_emit = gen3_emit_composite_spans_primitive_zero_no_offset;
src/sna/sna_accel.c +3 -0
index 934c8f662bea..8266e86d8fea 100644
@@ -4955,6 +4955,7 @@ try_upload__inplace(PixmapPtr pixmap, RegionRec *region,
 	case I915_TILING_X:
 		if (!sna->kgem.memcpy_to_tiled_x)
 			break;
+		/* fall through */
 	default:
 		if (try_upload__tiled_x(pixmap, region, x, y, w, h, bits, stride))
 			goto done;
@@ -8719,6 +8720,7 @@ sna_copy_plane_blt(DrawablePtr source, DrawablePtr drawable, GCPtr gc,
 				}
 			default:
 				assert(0);
+				/* fall through */
 			case 8:
 				{
 					uint8_t *src = src_pixmap->devPrivate.ptr;
@@ -10123,6 +10125,7 @@ spans_fallback:
 			switch (gc->lineStyle) {
 			default:
 				assert(0);
+				/* fall through */
 			case LineSolid:
 				if (gc->lineWidth == 0) {
 					DBG(("%s: miZeroLine\n", __FUNCTION__));
src/sna/sna_damage.h +1 -0
index d5c727eeee34..abdc786863a9 100644
@@ -152,6 +152,7 @@ static inline bool sna_damage_is_all(struct sna_damage **_damage,
 		return false;
 	default:
 		assert(0);
+		/* fall through */
 	case DAMAGE_ADD:
 		if (damage->extents.x2 < width  || damage->extents.x1 > 0)
 			return false;
src/sna/sna_display.c +4 -3
index d6210cc7bbc8..1e62cc40473f 100644
@@ -8309,7 +8309,7 @@ static bool sna_emit_wait_for_scanline_hsw(struct sna *sna,
 	sna->kgem.nbatch += 17;
 
 	switch (pipe) {
-	default: assert(0);
+	default: assert(0); /* fall through */
 	case 0: event = 1 << 0; break;
 	case 1: event = 1 << 8; break;
 	case 2: event = 1 << 14; break;
@@ -8325,7 +8325,7 @@ static bool sna_emit_wait_for_scanline_hsw(struct sna *sna,
 	/* The documentation says that the LOAD_SCAN_LINES command
 	 * always comes in pairs. Don't ask me why. */
 	switch (pipe) {
-	default: assert(0);
+	default: assert(0); /* fall through */
 	case 0: event = 0 << 19; break;
 	case 1: event = 1 << 19; break;
 	case 2: event = 4 << 19; break;
@@ -8334,7 +8334,7 @@ static bool sna_emit_wait_for_scanline_hsw(struct sna *sna,
 	b[9] = b[7] = (y1 << 16) | (y2-1);
 
 	switch (pipe) {
-	default: assert(0);
+	default: assert(0); /* fall through */
 	case 0: event = 1 << 0; break;
 	case 1: event = 1 << 8; break;
 	case 2: event = 1 << 14; break;
@@ -8374,6 +8374,7 @@ static bool sna_emit_wait_for_scanline_ivb(struct sna *sna,
 	switch (pipe) {
 	default:
 		assert(0);
+		/* fall through */
 	case 0:
 		event = 1 << (full_height ? 3 : 0);
 		break;
src/sna/sna_dri2.c +2 -0
index daa71dc6db30..5fd4d54b6d70 100644
@@ -680,6 +680,7 @@ sna_dri2_create_buffer(DrawablePtr draw,
 			    (sna->flags & (SNA_LINEAR_FB | SNA_NO_WAIT | SNA_NO_FLIP)) == 0)
 				flags |= CREATE_SCANOUT;
 		}
+		/* fall through */
 	case DRI2BufferBackRight:
 	case DRI2BufferFrontRight:
 	case DRI2BufferFakeFrontLeft:
@@ -2944,6 +2945,7 @@ static void sna_dri2_flip_event(struct sna_dri2_event *flip)
 			DBG(("%s: triple buffer swap complete, unblocking client\n", __FUNCTION__));
 			frame_swap_complete(flip, DRI2_FLIP_COMPLETE);
 		}
+		/* fall through */
 	case FLIP_COMPLETE:
 		assert(!flip->signal);
 		if (sna->dri2.flip_pending) {
src/sna/sna_driver.c +1 -0
index 754b2d4f130d..4f8895f1eda2 100644
@@ -603,6 +603,7 @@ static Bool sna_pre_init(ScrnInfoPtr scrn, int probe)
 		if ((sna->flags & SNA_IS_HOSTED) ||
 		    fb_supports_depth(fd, scrn->depth))
 			break;
+		/* fall through */
 	default:
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
 			   "Given depth (%d) is not supported by the Intel driver and this chipset.\n",
src/sna/sna_render.c +2 -2
index 1787ffae4874..904d44004d44 100644
@@ -58,7 +58,7 @@ sna_format_for_depth(int depth)
 	case 8: return PICT_a8;
 	case 15: return PICT_x1r5g5b5;
 	case 16: return PICT_r5g6b5;
-	default: assert(0);
+	default: assert(0); /* fall through */
 	case 24: return PICT_x8r8g8b8;
 #if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,6,99,900,0)
 	case 30: return PICT_x2r10g10b10;
@@ -77,7 +77,7 @@ sna_render_format_for_depth(int depth)
 	case 15: return PIXMAN_a1r5g5b5;
 	case 16: return PIXMAN_r5g6b5;
 	case 30: return PIXMAN_a2r10g10b10;
-	default: assert(0);
+	default: assert(0); /* fall through */
 	case 24:
 	case 32: return PIXMAN_a8r8g8b8;
 	}
src/uxa/intel_dri.c +1 -0
index 524826d24082..e707b74f091f 100644
@@ -302,6 +302,7 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
 					hint |= INTEL_CREATE_PIXMAP_TILING_Y;
 					break;
 				}
+				/* fall through */
 			case DRI2BufferAccum:
 			case DRI2BufferBackLeft:
 			case DRI2BufferBackRight:
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

PATCH 6/21 sna: Add sna_br13_color_depth()

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Refactor the BR13 color depth setup to common helper. This eliminates a bunch of implicit fall through warns.

---
 src/sna/kgem.c    | 10 +++------
 src/sna/sna.h     | 19 ++++++++++++++++
 src/sna/sna_blt.c | 56 ++++++++++-------------------------------------
 src/sna/sna_io.c  | 30 ++++++++-----------------
 4 files changed, 43 insertions(+), 72 deletions(-)
src/sna/kgem.c +3 -7
index d396f1b40dbc..9c0708a635fb 100644
@@ -8148,13 +8148,9 @@ kgem_replace_bo(struct kgem *kgem,
 	}
 
 	br13 |= 0xcc << 16;
-	switch (bpp) {
-	default:
-	case 32: br00 |= BLT_WRITE_ALPHA | BLT_WRITE_RGB;
-		 br13 |= 1 << 25; /* RGB8888 */
-	case 16: br13 |= 1 << 24; /* RGB565 */
-	case 8: break;
-	}
+	br13 |= sna_br13_color_depth(bpp);
+	if (bpp == 32)
+		br00 |= BLT_WRITE_ALPHA | BLT_WRITE_RGB;
 
 	b = kgem->batch + kgem->nbatch;
 	if (kgem->gen >= 0100) {
src/sna/sna.h +19 -0
index cf2a7a519f29..f2bc189624a5 100644
@@ -1397,4 +1397,23 @@ static inline void add_shm_flush(struct sna *sna, struct sna_pixmap *priv)
 	sna->needs_shm_flush = true;
 }
 
+static inline uint32_t sna_br13_color_depth(int bpp)
+{
+	uint32_t br13 = 0;
+
+	switch (bpp) {
+	default:
+		assert(0);
+		/* fall through */
+	case 32:
+		br13 |= 1 << 25; /* RGB8888 */
+		/* fall through */
+	case 16:
+		br13 |= 1 << 24; /* RGB565 */
+		/* fall through */
+	case 8:
+		return br13;
+	}
+}
+
 #endif /* _SNA_H */
src/sna/sna_blt.c +12 -44

98 lines not on this page · raw message

src/sna/sna_io.c +9 -21
index d32bd583fc42..d03280edb7a7 100644
@@ -465,13 +465,9 @@ fallback:
 	}
 
 	br13 = 0xcc << 16;
-	switch (cpp) {
-	default:
-	case 4: cmd |= BLT_WRITE_ALPHA | BLT_WRITE_RGB;
-		br13 |= 1 << 25; /* RGB8888 */
-	case 2: br13 |= 1 << 24; /* RGB565 */
-	case 1: break;
-	}
+	br13 |= sna_br13_color_depth(cpp * 4);
+	if (cpp == 4)
+		cmd |= BLT_WRITE_ALPHA | BLT_WRITE_RGB;
 
 	kgem_set_mode(kgem, KGEM_BLT, dst_bo);
 	if (!kgem_check_batch(kgem, 10) ||
@@ -1042,13 +1038,9 @@ tile:
 		br13 >>= 2;
 	}
 	br13 |= 0xcc << 16;
-	switch (dst->drawable.bitsPerPixel) {
-	default:
-	case 32: cmd |= BLT_WRITE_ALPHA | BLT_WRITE_RGB;
-		 br13 |= 1 << 25; /* RGB8888 */
-	case 16: br13 |= 1 << 24; /* RGB565 */
-	case 8: break;
-	}
+	br13 |= sna_br13_color_depth(dst->drawable.bitsPerPixel);
+	if (dst->drawable.bitsPerPixel == 32)
+		cmd |= BLT_WRITE_ALPHA | BLT_WRITE_RGB;
 
 	kgem_set_mode(kgem, KGEM_BLT, dst_bo);
 	if (!kgem_check_batch(kgem, 10) ||
@@ -1548,13 +1540,9 @@ tile:
 		br13 >>= 2;
 	}
 	br13 |= 0xcc << 16;
-	switch (dst->drawable.bitsPerPixel) {
-	default:
-	case 32: cmd |= BLT_WRITE_ALPHA | BLT_WRITE_RGB;
-		 br13 |= 1 << 25; /* RGB8888 */
-	case 16: br13 |= 1 << 24; /* RGB565 */
-	case 8: break;
-	}
+	br13 |= sna_br13_color_depth(dst->drawable.bitsPerPixel);
+	if (dst->drawable.bitsPerPixel == 32)
+		cmd |= BLT_WRITE_ALPHA | BLT_WRITE_RGB;
 
 	kgem_set_mode(kgem, KGEM_BLT, dst_bo);
 	if (!kgem_check_batch(kgem, 10) ||
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

PATCH 7/21 sna/fb: Eliminate implicit fallthrough

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Duplicate a bit of code in FbDoLeftMaskByteRRop() switch statement to avoid the fall through.

And while at it sort the cases based on the left byte and length. Makes the pattern matcher in my brain much happier.

---
 src/sna/fb/fb.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/sna/fb/fb.h +4 -2
index 904317478e8a..ee5da97b458c 100644
@@ -185,11 +185,13 @@ typedef int FbStride;
 	FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
 	FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
 	break; \
+    case sizeof (FbBits) - 3: \
+	FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
+	FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \
+	break; \
     case (sizeof (FbBits) - 2) | (1 << (FB_SHIFT - 3)): \
 	FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \
 	break; \
-    case sizeof (FbBits) - 3: \
-	FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \
     case sizeof (FbBits) - 2: \
 	FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \
 	break; \
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

PATCH 8/21 uxa: Use named initializers

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Silence the compiler warning about missing initializers by using named initializers.

---
 src/uxa/intel_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/uxa/intel_display.c +1 -1
index 809cda1dd56b..ba4b8d87412c 100644
@@ -1818,7 +1818,7 @@ error_out:
 }
 
 static const xf86CrtcConfigFuncsRec intel_xf86crtc_config_funcs = {
-	intel_xf86crtc_resize
+	.resize = intel_xf86crtc_resize,
 };
 
 /*
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 9/21 Avoid missing initializer warning

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Use an empty {} as the terminator in intel_device_match[] to avoid the warning about missing initlizers.

---
 src/intel_module.c | 2 +-
 src/meson.build    | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)
src/intel_module.c +1 -1
index 171b20d83d33..a71c2e40b774 100644
@@ -388,7 +388,7 @@ static const struct pci_id_match intel_device_match[] = {
 	INTEL_VGA_DEVICE(PCI_MATCH_ANY, &intel_generic_info),
 #endif
 
-	{ 0, 0, 0 },
+	{},
 };
 
 void
src/meson.build +0 -1
index 0a46e233a94c..1125c65b73be 100644
@@ -150,7 +150,6 @@ shared_module('intel_drv',
 		'-DMAJOR_IN_SYSMACROS',
 		'-Wno-unused-parameter',
 		'-Wno-sign-compare',
-		'-Wno-missing-field-initializers',
 	      ],
 	      name_prefix : '',
 	      install_dir : join_paths(moduledir, 'drivers'),
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 10/21 sna: Use named initializers

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Avoid -Wno-missing-field-initializers by using named initializers.

---
 src/sna/meson.build          | 1 -
 src/sna/sna_composite.c      | 2 +-
 src/sna/sna_display.c        | 6 +++---
 src/sna/sna_display_fake.c   | 2 +-
 src/sna/sna_video_overlay.c  | 6 +++++-
 src/sna/sna_video_sprite.c   | 8 +++++++-
 src/sna/sna_video_textured.c | 5 ++++-
 7 files changed, 21 insertions(+), 9 deletions(-)
src/sna/meson.build +0 -1
index b1276ab3aa6e..9e4b69f45e55 100644
@@ -129,7 +129,6 @@ sna = static_library('sna',
 		     link_with : [ brw, fb, ],
 		     include_directories : inc,
 		     c_args : [
-		       '-Wno-missing-field-initializers',
 		       '-Wno-unused-but-set-variable',
 		       '-Wno-expansion-to-defined',
 		       '-Wno-shift-negative-value',
src/sna/sna_composite.c +1 -1
index 1da8c29155b4..3a8e86845069 100644
@@ -1074,7 +1074,7 @@ sna_composite_rectangles(CARD8		 op,
 		}
 	} else {
 		for (i = 0; i < num_boxes; i++) {
-			RegionRec tmp = { boxes[i] };
+			RegionRec tmp = { .extents = boxes[i], };
 			if (pixman_region_intersect(&tmp, &tmp, dst->pCompositeClip)) {
 				int n = 0;
 
src/sna/sna_display.c +3 -3
index 1e62cc40473f..5c522011e056 100644
@@ -7316,7 +7316,7 @@ next_crtc:
 }
 
 static const xf86CrtcConfigFuncsRec sna_mode_funcs = {
-	sna_mode_resize
+	.resize = sna_mode_resize,
 };
 
 static void set_size_range(struct sna *sna)
@@ -7784,7 +7784,7 @@ static bool has_flip__async(struct sna *sna)
 	struct local_get_cap {
 		uint64_t name;
 		uint64_t value;
-	} cap = { DRM_CAP_ASYNC_PAGE_FLIP };
+	} cap = { .name = DRM_CAP_ASYNC_PAGE_FLIP, };
 
 	if (sna->flags & SNA_NO_FLIP)
 		return false;
@@ -9682,7 +9682,7 @@ fixup_flip:
 			     __FUNCTION__, __sna_crtc_id(crtc), crtc->flip_bo->handle, crtc->flip_bo->active_scanout, crtc->flip_serial));
 
 			{
-				struct drm_i915_gem_busy busy = { flip_bo->handle };
+				struct drm_i915_gem_busy busy = { .handle = flip_bo->handle, };
 				if (drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GEM_BUSY, &busy) == 0) {
 					if (busy.busy) {
 						int mode = KGEM_RENDER;
src/sna/sna_display_fake.c +1 -1
index fa26bda138d7..401e9a066534 100644
@@ -221,7 +221,7 @@ sna_mode_resize(ScrnInfoPtr scrn, int width, int height)
 }
 
 static const xf86CrtcConfigFuncsRec sna_mode_funcs = {
-	sna_mode_resize
+	.resize = sna_mode_resize,
 };
 
 static bool add_fake_output(struct sna *sna, bool late)
src/sna/sna_video_overlay.c +5 -1
index 9bc5ce40dc94..7c7bb4833662 100644
@@ -56,7 +56,11 @@ static Atom xvGamma0, xvGamma1, xvGamma2, xvGamma3, xvGamma4, xvGamma5;
 #define IMAGE_MAX_WIDTH_LEGACY	1024
 #define IMAGE_MAX_HEIGHT_LEGACY	1088
 
-static XvFormatRec Formats[] = { {15}, {16}, {24} };
+static XvFormatRec Formats[] = {
+	{ .depth = 15, },
+	{ .depth = 16, },
+	{ .depth = 24, },
+};
 
 static const XvAttributeRec Attributes[] = {
 	{XvSettable | XvGettable, 0, (1 << 24) - 1, (char *)"XV_COLORKEY"},
src/sna/sna_video_sprite.c +7 -1
index da676ad658fc..711a2fb261c0 100644
@@ -72,7 +72,13 @@ struct local_mode_set_plane {
 
 static Atom xvColorKey, xvAlwaysOnTop, xvSyncToVblank, xvColorspace;
 
-static XvFormatRec formats[] = { {8}, {15}, {16}, {24}, {30} };
+static XvFormatRec formats[] = {
+	{ .depth = 8, },
+	{ .depth = 15, },
+	{ .depth = 16, },
+	{ .depth = 24, },
+	{ .depth = 30, },
+};
 static const XvImageRec images[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
 				     XVMC_RGB888 };
 static const XvImageRec images_rgb565[] = { XVIMAGE_YUY2, XVIMAGE_UYVY,
src/sna/sna_video_textured.c +4 -1
index 06da36d03c03..6e30461d43be 100644
@@ -39,7 +39,10 @@
 static Atom xvBrightness, xvContrast, xvSyncToVblank, xvColorspace;
 
 static XvFormatRec Formats[] = {
-	{15}, {16}, {24}, {30}
+	{ .depth = 15, },
+	{ .depth = 16, },
+	{ .depth = 24, },
+	{ .depth = 30, },
 };
 
 static const XvAttributeRec Attributes[] = {
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 11/21 sna: Increase the size of the path name buffer a bit

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

../src/intel_device.c: In function ‘__intel_open_device__pci.isra.6’:
../src/intel_device.c:321:25: warning: ‘%s’ directive writing up to 255 bytes into a region of size 247 [-Wformat-overflow=]
sprintf(path + base, "%s", de->d_name);

---
 src/intel_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/intel_device.c +1 -1
index 219550731500..f28d3be11796 100644
@@ -301,9 +301,9 @@ static int open_cloexec(const char *path)
 #ifdef __linux__
 static int __intel_open_device__major_minor(int _major, int _minor)
 {
-	char path[256];
 	DIR *dir;
 	struct dirent *de;
+	char path[9+sizeof(de->d_name)];
 	int base, fd = -1;
 
 	base = sprintf(path, "/dev/dri/");
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

PATCH 12/21 sna: Use memcmp() to avoid strict aliasing warns

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

../src/sna/sna_display.c: In function ‘sna_covering_crtc’:
../src/sna/sna_display.c:8235:34: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
if (*(const uint64_t *)box == *(uint64_t *)&crtc->bounds) {

---
 src/sna/sna_display.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/sna/sna_display.c +1 -1
index 5c522011e056..5c377cf2d86d 100644
@@ -8232,7 +8232,7 @@ sna_covering_crtc(struct sna *sna, const BoxRec *box, xf86CrtcPtr desired)
 		     __FUNCTION__, c,
 		     crtc->bounds.x1, crtc->bounds.y1,
 		     crtc->bounds.x2, crtc->bounds.y2));
-		if (*(const uint64_t *)box == *(uint64_t *)&crtc->bounds) {
+		if (!memcmp(box, &crtc->bounds, sizeof(*box))) {
 			DBG(("%s: box exactly matches crtc [%d]\n",
 			     __FUNCTION__, c));
 			return crtc;
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

PATCH 13/21 sna: Avoid strict aliasing violations with glyphinfo

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Just access the xGlyphInfo members directly to avoid the compiler getting upset about strict aliasing violations.

---
 src/sna/sna_glyphs.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
src/sna/sna_glyphs.c +5 -2
index 6ee403360226..ebc061b5a8a8 100644
@@ -85,8 +85,11 @@
 #define NO_ATLAS ((PicturePtr)-1)
 #define GLYPH_TOLERANCE 3
 
-#define glyph_valid(g) *((uint32_t *)&(g)->info.width)
-#define glyph_copy_size(r, g) *(uint32_t *)&(r)->width = *(uint32_t *)&g->info.width
+#define glyph_valid(g) ((g)->info.width || (g)->info.height)
+#define glyph_copy_size(r, g) do { \
+	(r)->width = (g)->info.width; \
+	(r)->height = (g)->info.height; \
+} while (0)
 
 #if HAS_PIXMAN_GLYPHS
 static  pixman_glyph_cache_t *__global_glyph_cache;
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH 14/21 sna/fb: Use memcpy() to avoid strict aliasing violations

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Replace the cast+deref with memcpy() so that we don't upset the compiler's strict aliasing rules.

---
 src/sna/fb/fbspan.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
src/sna/fb/fbspan.c +4 -2
index 45cb7cc7bd6c..18136c200458 100644
@@ -39,12 +39,13 @@ fbFillSpans(DrawablePtr drawable, GCPtr gc,
 	while (n--) {
 		BoxRec box;
 
-		*(DDXPointPtr)&box = *pt++;
+		memcpy(&box, pt, sizeof(box));
 		box.x2 = box.x1 + *width++;
 		box.y2 = box.y1 + 1;
 
 		/* XXX fSorted */
 		fbDrawableRun(drawable, gc, &box, fbFillSpan, NULL);
+		pt++;
 	}
 }
 
@@ -91,7 +92,8 @@ fbSetSpans(DrawablePtr drawable, GCPtr gc,
 	while (n--) {
 		BoxRec box;
 
-		*(DDXPointPtr)&box = data.pt = *pt;
+		memcpy(&box, pt, sizeof(box));
+		data.pt = *pt;
 		box.x2 = box.x1 + *width;
 		box.y2 = box.y1 + 1;
 
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

PATCH 15/21 xvmc: Eliminate strict aliasing violations

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Just access both halves of the motion vector thing directly instead of doung the cast to uint and deref.

---
 src/legacy/i810/xvmc/I810XvMC.c | 48 ++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 24 deletions(-)
src/legacy/i810/xvmc/I810XvMC.c +24 -24
index a538e9991602..6780bba06b2c 100644
@@ -1246,8 +1246,8 @@ static __inline__ void renderFieldinField(uint **datay,uint **datau,
   *dy++ = (1<<30) | (3<<28) | dw1;
   *dy++ = xy;
   *dy++ = (16<<16) | 16;
-  *dy++ = *(uint *)fmv;
-  *dy++ = *(uint *)bmv;
+  *dy++ = fmv[1] << 16 | fmv[0];
+  *dy++ = bmv[1] << 16 | bmv[0];
   PACK_CORR_DATA(dy,block_ptr,ysize);
   block_ptr = (short *)((unsigned long)block_ptr + ysize);
   /* End Y Blocks */
@@ -1263,8 +1263,8 @@ static __inline__ void renderFieldinField(uint **datay,uint **datau,
   *du++ = (2<<30) | (1<<28) | dw1;
   *du++ = xy;
   *du++ = (8<<16) | 8;
-  *du++ = *(uint *)fmv;
-  *du++ = *(uint *)bmv;
+  *du++ = fmv[1] << 16 | fmv[0];
+  *du++ = bmv[1] << 16 | bmv[0];
   PACK_CORR_DATA(du,block_ptr,usize);
   block_ptr = (short *)((unsigned long)block_ptr + usize);
 
@@ -1273,8 +1273,8 @@ static __inline__ void renderFieldinField(uint **datay,uint **datau,
   *dv++ = (3<<30) | (1<<28) | dw1;
   *dv++ = xy;
   *dv++ = (8<<16) | 8;
-  *dv++ = *(uint *)fmv;
-  *dv++ = *(uint *)bmv;
+  *dv++ = fmv[1] << 16 | fmv[0];
+  *dv++ = bmv[1] << 16 | bmv[0];
   PACK_CORR_DATA(dv,block_ptr,vsize);
   block_ptr = (short *)((unsigned long)block_ptr + vsize);
 
@@ -1394,8 +1394,8 @@ static __inline__ void render16x8inField(uint **datay,uint **datau,
   *dy++ = (1<<30) | (2<<28) | dw1[0];
   *dy++ = xy;
   *dy++ = (8<<16) | 16;
-  *dy++ = *(uint *)fmv;
-  *dy++ = *(uint *)bmv;
+  *dy++ = fmv[1] << 16 | fmv[0];
+  *dy++ = bmv[1] << 16 | bmv[0];
   PACK_CORR_DATA(dy,block_ptr,y1size);
   block_ptr = (short *)((unsigned long)block_ptr + y1size);
 
@@ -1404,8 +1404,8 @@ static __inline__ void render16x8inField(uint **datay,uint **datau,
   *dy++ = (1<<30) | (2<<28) | dw1[1];
   *dy++ = (xy + 8);
   *dy++ = (8<<16) | 16;
-  *dy++ = *(uint *)&fmv[2];
-  *dy++ = *(uint *)&bmv[2];
+  *dy++ = fmv[3] << 16 | fmv[2];
+  *dy++ = bmv[3] << 16 | bmv[2];
   PACK_CORR_DATA(dy,block_ptr,y2size);
   block_ptr = (short *)((unsigned long)block_ptr + y2size);
   /* End Y Blocks */
@@ -1427,8 +1427,8 @@ static __inline__ void render16x8inField(uint **datay,uint **datau,
   *du++ = (2<<30) | (1<<28) | dw1[0];
   *du++ = xy;
   *du++ = (4<<16) | 8;
-  *du++ = *(uint *)fmv;
-  *du++ = *(uint *)bmv;
+  *du++ = fmv[1] << 16 | fmv[0];
+  *du++ = bmv[1] << 16 | bmv[0];
   PACK_CORR_DATA(du,block_ptr,usize);
   block_ptr = (short *)((unsigned long)block_ptr + usize);
 
@@ -1437,8 +1437,8 @@ static __inline__ void render16x8inField(uint **datay,uint **datau,
   *du++ = (2<<30) | (1<<28) | dw1[1];
   *du++ = (xy + 4);
   *du++ = (4<<16) | 8;
-  *du++ = *(uint *)&fmv[2];
-  *du++ = *(uint *)&bmv[2];
+  *du++ = fmv[3] << 16 | fmv[2];
+  *du++ = bmv[3] << 16 | bmv[2];
   PACK_CORR_DATA(du,block_ptr,usize);
   block_ptr = (short *)((unsigned long)block_ptr + usize);
   /* End U Blocks */
@@ -1448,8 +1448,8 @@ static __inline__ void render16x8inField(uint **datay,uint **datau,
   *dv++ = (3<<30) | (1<<28) | dw1[0];
   *dv++ = xy;
   *dv++ = (4<<16) | 8;
-  *dv++ = *(uint *)fmv;
-  *dv++ = *(uint *)bmv;
+  *dv++ = fmv[1] << 16 | fmv[0];
+  *dv++ = bmv[1] << 16 | bmv[0];
   PACK_CORR_DATA(dv,block_ptr,vsize);
   block_ptr = (short *)((unsigned long)block_ptr + vsize);
 
@@ -1458,8 +1458,8 @@ static __inline__ void render16x8inField(uint **datay,uint **datau,
   *dv++ = (3<<30) | (1<<28) | dw1[1];
   *dv++ = (xy + 4);
   *dv++ = (4<<16) | 8;
-  *dv++ = *(uint *)&fmv[2];
-  *dv++ = *(uint *)&bmv[2];
+  *dv++ = fmv[3] << 16 | fmv[2];
+  *dv++ = bmv[3] << 16 | bmv[2];
   PACK_CORR_DATA(dv,block_ptr,vsize);
   block_ptr = (short *)((unsigned long)block_ptr + vsize);
   /* End V Blocks */
@@ -1513,8 +1513,8 @@ static __inline__ void renderDualPrimeinField(uint **datay,uint **datau,
   *dy++ = (1<<30) | (3<<28) | dw1;
   *dy++ = xy;
   *dy++ = (16<<16) | 16;
-  *dy++ = *(uint *)fmv;
-  *dy++ = *(uint *)bmv;
+  *dy++ = fmv[1] << 16 | fmv[0];
+  *dy++ = bmv[1] << 16 | bmv[0];
   PACK_CORR_DATA(dy,block_ptr,ysize);
   block_ptr = (short *)((unsigned long)block_ptr + ysize);
   /* End Y Blocks */
@@ -1530,8 +1530,8 @@ static __inline__ void renderDualPrimeinField(uint **datay,uint **datau,
   *du++ = (2<<30) | (1<<28) | dw1;
   *du++ = xy;
   *du++ = (8<<16) | 8;
-  *du++ = *(uint *)fmv;
-  *du++ = *(uint *)bmv;
+  *du++ = fmv[1] << 16 | fmv[0];
+  *du++ = bmv[1] << 16 | bmv[0];
   PACK_CORR_DATA(du,block_ptr,usize);
   block_ptr = (short *)((unsigned long)block_ptr + usize);
 
@@ -1540,8 +1540,8 @@ static __inline__ void renderDualPrimeinField(uint **datay,uint **datau,
   *dv++ = (3<<30) | (1<<28) | dw1;
   *dv++ = xy;
   *dv++ = (8<<16) | 8;
-  *dv++ = *(uint *)fmv;
-  *dv++ = *(uint *)bmv;
+  *dv++ = fmv[1] << 16 | fmv[0];
+  *dv++ = bmv[1] << 16 | bmv[0];
   PACK_CORR_DATA(dv,block_ptr,vsize);
   block_ptr = (short *)((unsigned long)block_ptr + vsize);
 
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

PATCH 16/21 sna/fb: Initialize xoff/yoff

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

The compiler seems to think src/mask xoff/yoff can be used uninitialized. Zero them to make sure.

---
 src/sna/fb/fbpict.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
src/sna/fb/fbpict.c +5 -1
index abe223f31c88..8e65deb26fe9 100644
@@ -313,8 +313,10 @@ image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
 {
 	pixman_image_t *image = NULL;
 
-	if (!pict)
+	if (!pict) {
+		*xoff = *yoff = 0;
 		return NULL;
+	}
 
 	if (pict->pDrawable) {
 		image = create_bits_picture(pict, has_clip, xoff, yoff);
@@ -336,6 +338,8 @@ image_from_pict_internal(PicturePtr pict, Bool has_clip, int *xoff, int *yoff,
 				image = create_conical_gradient_image(gradient);
 		}
 		*xoff = *yoff = 0;
+	} else {
+		*xoff = *yoff = 0;
 	}
 
 	if (image)
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

PATCH 17/21 sna: Use -Wno-maybe-uninitialized

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

The compiler seems incapable of deducing whether something is used uninitialized or not.

---
 src/sna/meson.build | 1 +
 1 file changed, 1 insertion(+)
src/sna/meson.build +1 -0
index 9e4b69f45e55..7408f63c82db 100644
@@ -132,6 +132,7 @@ sna = static_library('sna',
 		       '-Wno-unused-but-set-variable',
 		       '-Wno-expansion-to-defined',
 		       '-Wno-shift-negative-value',
+		       '-Wno-maybe-uninitialized',
 		       '-Wno-unused-parameter',
 		       '-Wno-unused-function',
 		       '-Wno-unused-variable',
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

PATCH 18/21 sna: Get rid of -Wno-shift-negative-value

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Use a cast to avoid the "left shift of negative value [-Wshift-negative-value]" warning, and get rid of the suppression.

---
 src/sna/meson.build           | 1 -
 src/sna/sna_trapezoids_mono.c | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
src/sna/meson.build +0 -1
index 7408f63c82db..e1eb25f2be36 100644
@@ -131,7 +131,6 @@ sna = static_library('sna',
 		     c_args : [
 		       '-Wno-unused-but-set-variable',
 		       '-Wno-expansion-to-defined',
-		       '-Wno-shift-negative-value',
 		       '-Wno-maybe-uninitialized',
 		       '-Wno-unused-parameter',
 		       '-Wno-unused-function',
src/sna/sna_trapezoids_mono.c +1 -1
index 07a7867d7f09..1582c96c57e8 100644
@@ -657,7 +657,7 @@ mono_init(struct mono *c, int num_edges)
 
 	c->head.dy = 0;
 	c->head.height_left = INT_MAX;
-	c->head.x.quo = INT16_MIN << 16;
+	c->head.x.quo = (uint32_t)INT16_MIN << 16;
 	c->head.prev = NULL;
 	c->head.next = &c->tail;
 	c->tail.prev = &c->head;
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

PATCH 19/21 uxa: Get rid of -Wno-shift-negative-value

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

The minimum CS URB entry size is 1. Let's use that instead of 0 so that we don't end up left shifting a -1.

---
 src/uxa/i965_render.c | 2 +-
 src/uxa/i965_video.c  | 2 +-
 src/uxa/meson.build   | 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)
src/uxa/i965_render.c +1 -1
index c1943fb6b5a8..32dbf2f95173 100644
@@ -277,7 +277,7 @@ i965_check_composite_texture(ScreenPtr screen, PicturePtr picture)
 /* Set up a default static partitioning of the URB, which is supposed to
  * allow anything we would want to do, at potentially lower performance.
  */
-#define URB_CS_ENTRY_SIZE     0
+#define URB_CS_ENTRY_SIZE     1
 #define URB_CS_ENTRIES	      0
 
 #define URB_VS_ENTRY_SIZE     1	// each 512-bit row
src/uxa/i965_video.c +1 -1
index 9b9203b66f25..fcd5657d9426 100644
@@ -378,7 +378,7 @@ static void i965_post_draw_debug(ScrnInfoPtr scrn)
 #define URB_SF_ENTRY_SIZE     2
 
 #define URB_CS_ENTRIES	      0
-#define URB_CS_ENTRY_SIZE     0
+#define URB_CS_ENTRY_SIZE     1
 
 static void i965_create_dst_surface_state(ScrnInfoPtr scrn,
 					PixmapPtr pixmap,
src/uxa/meson.build +0 -1
index 5f0929ae32a9..f4a3302d3655 100644
@@ -58,7 +58,6 @@ uxa = static_library('uxa',
 		     include_directories : inc,
 		     c_args : [
 		       '-Wno-deprecated-declarations',
-		       '-Wno-shift-negative-value',
 		       '-Wno-unused-parameter',
 		       '-Wno-sign-compare',
 		     ],
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

PATCH 20/21 tools: Get rid of -Wno-sign-compare

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Fix the sign comparison warnings by changing some types, and using a few casts.

---
 tools/backlight_helper.c |  2 +-
 tools/meson.build        |  2 --
 tools/virtual.c          | 18 +++++++++---------
 3 files changed, 10 insertions(+), 12 deletions(-)
tools/backlight_helper.c +1 -1
index aadb8fac92ba..65151a534009 100644
@@ -51,7 +51,7 @@ int main(int argc, char *argv[])
 
 	if (snprintf(buf, sizeof(buf),
 		     "/sys/class/backlight/%s/brightness",
-		     argv[1]) >= sizeof(buf))
+		     argv[1]) >= (int)sizeof(buf))
 		die("Invalid interface '%s': name too long\n", argv[1]);
 
 	fd = open(buf, O_RDWR);
tools/meson.build +0 -2
index b4621abb3c7c..3df33385be3b 100644
@@ -17,7 +17,6 @@ if with_tools
 	     ],
 	     c_args : [
 	       '-Wno-unused-parameter',
-	       '-Wno-sign-compare',
 	     ],
 	     install : true)
 
@@ -81,7 +80,6 @@ if with_backlight_helper
 	     install_mode : [ 'rws--x--x', 'root', 'root' ],
 	     c_args : [
 	       '-DMAJOR_IN_SYSMACROS',
-	       '-Wno-sign-compare',
 	     ],
 	     install : true)
 
tools/virtual.c +9 -9
index fc8db2b9f2e2..010a3aab7cf3 100644
@@ -121,7 +121,7 @@ struct display {
 	int cursor_y;
 	int cursor_moved;
 	int cursor_visible;
-	int cursor;
+	Cursor cursor;
 
 	int flush;
 	int send;
@@ -148,7 +148,7 @@ struct output {
 	Pixmap pixmap;
 	GC gc;
 
-	long serial;
+	unsigned long serial;
 	int use_shm;
 	int use_shm_pixmap;
 	XShmSegmentInfo shm;
@@ -166,7 +166,7 @@ struct clone {
 	struct clone *active;
 
 	struct output src, dst;
-	long timestamp;
+	Time timestamp;
 
 	XShmSegmentInfo shm;
 	XImage image;
@@ -194,8 +194,8 @@ struct context {
 
 	int timer_active;
 
-	long timestamp;
-	long configTimestamp;
+	Time timestamp;
+	Time configTimestamp;
 
 	Atom singleton;
 	char command[1024];
@@ -597,7 +597,7 @@ static int mode_equal(const XRRModeInfo *a, const XRRModeInfo *b)
 		a->modeFlags == b->modeFlags);
 }
 
-static XRRModeInfo *lookup_mode(XRRScreenResources *res, int id)
+static XRRModeInfo *lookup_mode(XRRScreenResources *res, RRMode id)
 {
 	int i;
 
@@ -3055,7 +3055,7 @@ static int first_display_send_command(struct context *ctx, int timeout,
 	va_start(va, format);
 	len = vsnprintf(buf+4, sizeof(buf)-4, format, va)+5;
 	va_end(va);
-	assert(len < sizeof(buf));
+	assert(len < (int)sizeof(buf));
 
 	DBG(X11, ("%s: send command '%s'\n", DisplayString(display->dpy), buf));
 
@@ -3063,7 +3063,7 @@ static int first_display_send_command(struct context *ctx, int timeout,
 	while (len) {
 		XClientMessageEvent msg;
 		int n = len;
-		if (n > sizeof(msg.data.b))
+		if (n > (int)sizeof(msg.data.b))
 			n = sizeof(msg.data.b);
 		len -= n;
 
@@ -3113,7 +3113,7 @@ static void first_display_handle_command(struct context *ctx,
 	for (len = 0; len < 20 && msg[len]; len++)
 		;
 
-	if (ctx->command_continuation + len > sizeof(ctx->command)) {
+	if (ctx->command_continuation + len > (int)sizeof(ctx->command)) {
 		ctx->command_continuation = 0;
 		return;
 	}
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

PATCH 21/21 sna: Fix compiler warnings due to DrawablePtr vs. PixmapPtr

In reply to Ville Syrjala

From: Ville Syrjälä <[email protected]>

Deal with xserver commit 8e3b26ceaa86 ("Make PixmapDirtyUpdateRec::src a DrawablePtr")

Not sure this is still correct though. Is this stuff limited to pixmaps anymore?

---
 src/sna/sna_accel.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
src/sna/sna_accel.c +19 -1
index 8266e86d8fea..fa386ff6b9a6 100644
@@ -17518,7 +17518,11 @@ static bool has_offload_slaves(struct sna *sna)
 	PixmapDirtyUpdatePtr dirty;
 
 	xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
+#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
+		assert(dirty->src == &sna->front->drawable);
+#else
 		assert(dirty->src == sna->front);
+#endif
 		if (RegionNotEmpty(DamageRegion(dirty->damage)))
 			return true;
 	}
@@ -17679,7 +17683,11 @@ static void sna_accel_post_damage(struct sna *sna)
 		if (RegionNil(damage))
 			continue;
 
-		src = dirty->src;
+#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
+		assert(dirty->src->type == DRAWABLE_PIXMAP);
+#endif
+
+		src = (PixmapPtr)dirty->src;
 		dst = dirty->slave_dst->master_pixmap;
 
 		region.extents.x1 = dirty->x;
@@ -17930,9 +17938,15 @@ migrate_dirty_tracking(PixmapPtr old_front, PixmapPtr new_front)
 	PixmapDirtyUpdatePtr dirty, safe;
 
 	xorg_list_for_each_entry_safe(dirty, safe, &screen->pixmap_dirty_list, ent) {
+#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
+		assert(dirty->src == &old_front->drawable);
+		if (dirty->src != &old_front->drawable)
+			continue;
+#else
 		assert(dirty->src == old_front);
 		if (dirty->src != old_front)
 			continue;
+#endif
 
 		DamageUnregister(&dirty->src->drawable, dirty->damage);
 		DamageDestroy(dirty->damage);
@@ -17947,7 +17961,11 @@ migrate_dirty_tracking(PixmapPtr old_front, PixmapPtr new_front)
 		}
 
 		DamageRegister(&new_front->drawable, dirty->damage);
+#ifdef HAS_DIRTYTRACKING_DRAWABLE_SRC
+		dirty->src = &new_front->drawable;
+#else
 		dirty->src = new_front;
+#endif
 	}
 #endif
 }
Signature · 6 lines
2.21.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw
In reply to Ville Syrjala

Quoting Ville Syrjala (2019-09-19 17:30:52)

Quoted 5 lines

From: Ville Syrjälä <[email protected]>

Random smattering of patches to eliminate compiler warnings. Some I just suppressed out of lazyness, others I tried to silence by adjusting the code a bit.

Some of the aliasing pointer avoidance looked silly, but silly compiler is silly.

Quoted 3 lines

Afterwards the build is clean on my gcc 8.3, though with a bunch of stuff still suppressed I'm not 100% sure that's a good thing.

Definitely quieter which is much less offputting.
Thanks,
-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx