Skip to contentSkip to conversation

i915: fix build on gcc7

PATCH In review Aleksa Sarai 3 participants 4 messages Jun 1, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i915: fix build on gcc7

With gcc7, the conditional usage of (port == PORT_A ? PORT_C : PORT_A) triggers -Werror=int-in-bool-context which breaks the build. Instead, use a temporary port_other variable that avoids hitting this error.

% gcc --version
gcc (SUSE Linux) 7.1.1 20170517 [gcc-7-branch revision 248152]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% make -j8 drivers/gpu/drm/i915/intel_dsi.o
In file included from drivers/gpu/drm/i915/intel_dsi.c:34:0:
drivers/gpu/drm/i915/intel_dsi.c: In function ‘intel_dsi_prepare’:
drivers/gpu/drm/i915/intel_dsi.c:1487:23: error: ?: using integer constants in boolean context [-Werror=int-in-bool-context]

         PORT_A ? PORT_C : PORT_A),
  drivers/gpu/drm/i915/i915_drv.h:3909:76: note: in definition of macro ‘I915_WRITE’
   #define I915_WRITE(reg, val) dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), true)
                                                                              ^~~
  drivers/gpu/drm/i915/i915_reg.h:8280:32: note: in expansion of macro ‘_MMIO’
   #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
                                  ^~~~~
  drivers/gpu/drm/i915/i915_reg.h:8280:38: note: in expansion of macro ‘_MIPI_PORT’
   #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
                                        ^~~~~~~~~~
  drivers/gpu/drm/i915/i915_reg.h:8624:32: note: in expansion of macro ‘_MMIO_MIPI’
   #define MIPI_INIT_COUNT(port)  _MMIO_MIPI(port, _MIPIA_INIT_COUNT, _MIPIC_INIT_COUNT)
                                  ^~~~~~~~~~
  drivers/gpu/drm/i915/intel_dsi.c:1486:15: note: in expansion of macro ‘MIPI_INIT_COUNT’
      I915_WRITE(MIPI_INIT_COUNT(port ==
                 ^~~~~~~~~~~~~~~
---
 drivers/gpu/drm/i915/intel_dsi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +3 -2
index 54030b68406a..53e717e7b811 100644
@@ -1476,14 +1476,15 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder,
 				txclkesc(intel_dsi->escape_clk_div, 100));
 
 		if (IS_GEN9_LP(dev_priv) && (!intel_dsi->dual_link)) {
+			enum port port_other = port == PORT_A ? PORT_C : PORT_A;
+
 			/*
 			 * BXT spec says write MIPI_INIT_COUNT for
 			 * both the ports, even if only one is
 			 * getting used. So write the other port
 			 * if not in dual link mode.
 			 */
-			I915_WRITE(MIPI_INIT_COUNT(port ==
-						PORT_A ? PORT_C : PORT_A),
+			I915_WRITE(MIPI_INIT_COUNT(port_other),
 					intel_dsi->init_count);
 		}
 
Signature · 6 lines
2.13.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#1 lore raw
Quoted 30 lines · Aleksa Sarai

With gcc7, the conditional usage of (port == PORT_A ? PORT_C : PORT_A) triggers -Werror=int-in-bool-context which breaks the build. Instead, use a temporary port_other variable that avoids hitting this error.

% gcc --version
gcc (SUSE Linux) 7.1.1 20170517 [gcc-7-branch revision 248152]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% make -j8 drivers/gpu/drm/i915/intel_dsi.o
In file included from drivers/gpu/drm/i915/intel_dsi.c:34:0:
drivers/gpu/drm/i915/intel_dsi.c: In function ‘intel_dsi_prepare’:
drivers/gpu/drm/i915/intel_dsi.c:1487:23: error: ?: using integer constants in boolean context [-Werror=int-in-bool-context]

         PORT_A ? PORT_C : PORT_A),
  drivers/gpu/drm/i915/i915_drv.h:3909:76: note: in definition of macro ‘I915_WRITE’
   #define I915_WRITE(reg, val) dev_priv->uncore.funcs.mmio_writel(dev_priv, (reg), (val), true)
                                                                              ^~~
  drivers/gpu/drm/i915/i915_reg.h:8280:32: note: in expansion of macro ‘_MMIO’
   #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
                                  ^~~~~
  drivers/gpu/drm/i915/i915_reg.h:8280:38: note: in expansion of macro ‘_MIPI_PORT’
   #define _MMIO_MIPI(port, a, c) _MMIO(_MIPI_PORT(port, a, c))
                                        ^~~~~~~~~~
  drivers/gpu/drm/i915/i915_reg.h:8624:32: note: in expansion of macro ‘_MMIO_MIPI’
   #define MIPI_INIT_COUNT(port)  _MMIO_MIPI(port, _MIPIA_INIT_COUNT, _MIPIC_INIT_COUNT)
                                  ^~~~~~~~~~
  drivers/gpu/drm/i915/intel_dsi.c:1486:15: note: in expansion of macro ‘MIPI_INIT_COUNT’
      I915_WRITE(MIPI_INIT_COUNT(port ==
                 ^~~~~~~~~~~~~~~
Quoted 1 line

This is probably already fixed in drm-next by

commit 0ad4dc887d4168448e8c801aa4edd8fe1e0bd534

Author: Hans de Goede <[email protected]>
Date:   Thu May 18 13:06:44 2017 +0200

drm/i915: Fix new -Wint-in-bool-context gcc compiler warning

which I also think is a more sensible fix than this one.

BR,
Jani.

Quoted 25 lines
---
 drivers/gpu/drm/i915/intel_dsi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +3 -2
index 54030b68406a..53e717e7b811 100644
@@ -1476,14 +1476,15 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder,
 				txclkesc(intel_dsi->escape_clk_div, 100));
 
 		if (IS_GEN9_LP(dev_priv) && (!intel_dsi->dual_link)) {
+			enum port port_other = port == PORT_A ? PORT_C : PORT_A;
+
 			/*
 			 * BXT spec says write MIPI_INIT_COUNT for
 			 * both the ports, even if only one is
 			 * getting used. So write the other port
 			 * if not in dual link mode.
 			 */
-			I915_WRITE(MIPI_INIT_COUNT(port ==
-						PORT_A ? PORT_C : PORT_A),
+			I915_WRITE(MIPI_INIT_COUNT(port_other),
 					intel_dsi->init_count);
 		}
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
#2 lore raw
Quoted 9 lines

This is probably already fixed in drm-next by

commit 0ad4dc887d4168448e8c801aa4edd8fe1e0bd534

Author: Hans de Goede <[email protected]>
Date:   Thu May 18 13:06:44 2017 +0200

drm/i915: Fix new -Wint-in-bool-context gcc compiler warning

Quoted 1 line

which I also think is a more sensible fix than this one.

Ah, I didn't see that patch. Yeah, you're right.

Signature · 8 lines
Aleksa Sarai
Software Engineer (Containers)
SUSE Linux GmbH
https://www.cyphar.com/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

✓ Fi.CI.BAT: success for i915: fix build on gcc7

In reply to Aleksa Sarai
== Series Details ==

== Series Details ==

Series: i915: fix build on gcc7
URL : https://patchwork.freedesktop.org/series/25158/
State : success

== Summary ==

Series 25158v1 i915: fix build on gcc7
https://patchwork.freedesktop.org/api/1.0/series/25158/revisions/1/mbox/

Test gem_exec_flush:

        Subgroup basic-batch-kernel-default-uc:
                pass       -> FAIL       (fi-snb-2600) fdo#100007
Test kms_busy:
        Subgroup basic-flip-default-c:
                pass       -> DMESG-WARN (fi-skl-6700hq) fdo#101144 +1
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-skl-6700hq) fdo#101154 +7

fdo#100007 https://bugs.freedesktop.org/show_bug.cgi?id=100007
fdo#101144 https://bugs.freedesktop.org/show_bug.cgi?id=101144
fdo#101154 https://bugs.freedesktop.org/show_bug.cgi?id=101154

fi-bdw-5557u     total:278  pass:267  dwarn:0   dfail:0   fail:0   skip:11  time:445s
fi-bdw-gvtdvm    total:278  pass:256  dwarn:8   dfail:0   fail:0   skip:14  time:435s
fi-bsw-n3050     total:278  pass:242  dwarn:0   dfail:0   fail:0   skip:36  time:577s
fi-bxt-j4205     total:278  pass:259  dwarn:0   dfail:0   fail:0   skip:19  time:515s
fi-byt-j1900     total:278  pass:254  dwarn:0   dfail:0   fail:0   skip:24  time:490s
fi-byt-n2820     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:477s
fi-hsw-4770      total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:431s
fi-hsw-4770r     total:278  pass:262  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-ilk-650       total:278  pass:228  dwarn:0   dfail:0   fail:0   skip:50  time:417s
fi-ivb-3520m     total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:496s
fi-ivb-3770      total:278  pass:260  dwarn:0   dfail:0   fail:0   skip:18  time:467s
fi-kbl-7500u     total:278  pass:255  dwarn:5   dfail:0   fail:0   skip:18  time:467s
fi-kbl-7560u     total:278  pass:263  dwarn:5   dfail:0   fail:0   skip:10  time:567s
fi-skl-6260u     total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:462s
fi-skl-6700hq    total:278  pass:230  dwarn:1   dfail:0   fail:25  skip:22  time:405s
fi-skl-6700k     total:278  pass:256  dwarn:4   dfail:0   fail:0   skip:18  time:465s
fi-skl-6770hq    total:278  pass:268  dwarn:0   dfail:0   fail:0   skip:10  time:506s
fi-skl-gvtdvm    total:278  pass:265  dwarn:0   dfail:0   fail:0   skip:13  time:435s
fi-snb-2520m     total:278  pass:250  dwarn:0   dfail:0   fail:0   skip:28  time:533s
fi-snb-2600      total:278  pass:248  dwarn:0   dfail:0   fail:1   skip:29  time:403s

5f6a8e63980502f7372abb6f1e43354dcaf59280 drm-tip: 2017y-06m-01d-10h-53m-42s UTC integration manifest 0c7e7ed i915: fix build on gcc7

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_4855/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx