* [PATCH] drm/i915: Explicitly convert some macros to boolean values
@ 2016-07-04 14:50 Tvrtko Ursulin
2016-07-04 15:06 ` Chris Wilson
2016-07-04 15:26 ` ✗ Ro.CI.BAT: failure for " Patchwork
0 siblings, 2 replies; 4+ messages in thread
From: Tvrtko Ursulin @ 2016-07-04 14:50 UTC (permalink / raw)
To: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Some IS_ and HAS_ macros can return any non-zero value for true.
One potential problem with that is that someone could assign
them to integers and be surprised with the result. Therefore it
is probably safer to do the conversion to 0/1 in the macros
themselves.
Luckily this does not seem to have an effect on code size.
Only one call site was getting bit by this and a patch for
that has been sent as "drm/i915/guc: Protect against HAS_GUC_*
returning true values other than one".
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 04a7423cd67f..534b8a8f41bf 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2762,14 +2762,14 @@ struct drm_i915_cmd_table {
* have their own (e.g. HAS_PCH_SPLIT for ILK+ display, IS_foo for particular
* chips, etc.).
*/
-#define IS_GEN2(dev) (INTEL_INFO(dev)->gen_mask & BIT(1))
-#define IS_GEN3(dev) (INTEL_INFO(dev)->gen_mask & BIT(2))
-#define IS_GEN4(dev) (INTEL_INFO(dev)->gen_mask & BIT(3))
-#define IS_GEN5(dev) (INTEL_INFO(dev)->gen_mask & BIT(4))
-#define IS_GEN6(dev) (INTEL_INFO(dev)->gen_mask & BIT(5))
-#define IS_GEN7(dev) (INTEL_INFO(dev)->gen_mask & BIT(6))
-#define IS_GEN8(dev) (INTEL_INFO(dev)->gen_mask & BIT(7))
-#define IS_GEN9(dev) (INTEL_INFO(dev)->gen_mask & BIT(8))
+#define IS_GEN2(dev) !!(INTEL_INFO(dev)->gen_mask & BIT(1))
+#define IS_GEN3(dev) !!(INTEL_INFO(dev)->gen_mask & BIT(2))
+#define IS_GEN4(dev) !!(INTEL_INFO(dev)->gen_mask & BIT(3))
+#define IS_GEN5(dev) !!(INTEL_INFO(dev)->gen_mask & BIT(4))
+#define IS_GEN6(dev) !!(INTEL_INFO(dev)->gen_mask & BIT(5))
+#define IS_GEN7(dev) !!(INTEL_INFO(dev)->gen_mask & BIT(6))
+#define IS_GEN8(dev) !!(INTEL_INFO(dev)->gen_mask & BIT(7))
+#define IS_GEN9(dev) !!(INTEL_INFO(dev)->gen_mask & BIT(8))
#define ENGINE_MASK(id) BIT(id)
#define RENDER_RING ENGINE_MASK(RCS)
@@ -2780,7 +2780,7 @@ struct drm_i915_cmd_table {
#define ALL_ENGINES (~0)
#define HAS_ENGINE(dev_priv, id) \
- (INTEL_INFO(dev_priv)->ring_mask & ENGINE_MASK(id))
+ !!(INTEL_INFO(dev_priv)->ring_mask & ENGINE_MASK(id))
#define HAS_BSD(dev_priv) HAS_ENGINE(dev_priv, VCS)
#define HAS_BSD2(dev_priv) HAS_ENGINE(dev_priv, VCS2)
@@ -2789,7 +2789,7 @@ struct drm_i915_cmd_table {
#define HAS_LLC(dev) (INTEL_INFO(dev)->has_llc)
#define HAS_SNOOP(dev) (INTEL_INFO(dev)->has_snoop)
-#define HAS_EDRAM(dev) (__I915__(dev)->edram_cap & EDRAM_ENABLED)
+#define HAS_EDRAM(dev) !!(__I915__(dev)->edram_cap & EDRAM_ENABLED)
#define HAS_WT(dev) ((IS_HASWELL(dev) || IS_BROADWELL(dev)) && \
HAS_EDRAM(dev))
#define I915_NEED_GFX_HWS(dev) (INTEL_INFO(dev)->need_gfx_hws)
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/i915: Explicitly convert some macros to boolean values
2016-07-04 14:50 [PATCH] drm/i915: Explicitly convert some macros to boolean values Tvrtko Ursulin
@ 2016-07-04 15:06 ` Chris Wilson
2016-07-04 15:26 ` ✗ Ro.CI.BAT: failure for " Patchwork
1 sibling, 0 replies; 4+ messages in thread
From: Chris Wilson @ 2016-07-04 15:06 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: Intel-gfx
On Mon, Jul 04, 2016 at 03:50:23PM +0100, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Some IS_ and HAS_ macros can return any non-zero value for true.
>
> One potential problem with that is that someone could assign
> them to integers and be surprised with the result. Therefore it
> is probably safer to do the conversion to 0/1 in the macros
> themselves.
>
> Luckily this does not seem to have an effect on code size.
Indeed, gcc is quite happy to remove the !! and combine
e.g. IS_GEN6() || IS_GEN7() into a single testb.
With that,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* ✗ Ro.CI.BAT: failure for drm/i915: Explicitly convert some macros to boolean values
2016-07-04 14:50 [PATCH] drm/i915: Explicitly convert some macros to boolean values Tvrtko Ursulin
2016-07-04 15:06 ` Chris Wilson
@ 2016-07-04 15:26 ` Patchwork
2016-07-04 15:47 ` Tvrtko Ursulin
1 sibling, 1 reply; 4+ messages in thread
From: Patchwork @ 2016-07-04 15:26 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: intel-gfx
== Series Details ==
Series: drm/i915: Explicitly convert some macros to boolean values
URL : https://patchwork.freedesktop.org/series/9475/
State : failure
== Summary ==
Series 9475v1 drm/i915: Explicitly convert some macros to boolean values
http://patchwork.freedesktop.org/api/1.0/series/9475/revisions/1/mbox
Test drv_hangman:
Subgroup error-state-basic:
fail -> PASS (ro-skl3-i5-6260u)
Test drv_module_reload_basic:
dmesg-fail -> DMESG-WARN (ro-skl3-i5-6260u)
Test gem_busy:
Subgroup basic-blt:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-bsd:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-bsd1:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-bsd2:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-parallel-blt:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-parallel-bsd:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-parallel-bsd1:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-parallel-bsd2:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-parallel-render:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-parallel-vebox:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-render:
skip -> PASS (ro-skl3-i5-6260u)
Subgroup basic-vebox:
skip -> PASS (ro-skl3-i5-6260u)
Test gem_cpu_reloc:
Subgroup basic:
fail -> PASS (ro-skl3-i5-6260u)
Test gem_cs_tlb:
Subgroup basic-default:
fail -> PASS (ro-skl3-i5-6260u)
Test gem_ctx_create:
Subgroup basic-files:
fail -> PASS (ro-skl3-i5-6260u)
Test gem_ctx_exec:
Subgroup basic:
fail -> PASS (ro-skl3-i5-6260u)
Test gem_ctx_switch:
Subgroup basic-default:
skip -> PASS (ro-skl3-i5-6260u)
Test gem_exec_basic:
Subgroup basic-blt:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup basic-bsd:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup basic-bsd1:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup basic-bsd2:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup basic-default:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup basic-render:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup basic-vebox:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup gtt-blt:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup gtt-bsd:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup gtt-bsd1:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup gtt-bsd2:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup gtt-default:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup gtt-render:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup gtt-vebox:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup readonly-blt:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup readonly-bsd:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup readonly-bsd1:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup readonly-bsd2:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup readonly-default:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup readonly-render:
fail -> PASS (ro-skl3-i5-6260u)
Subgroup readonly-vebox:
fail -> PASS (ro-skl3-i5-6260u)
Test gem_exec_create:
Subgroup basic:
fail -> PASS (ro-skl3-i5-6260u)
Test gem_exec_flush:
Subgroup basic-batch-kernel-default-uc:
fail -> PASS (ro-skl3-i5-6260u)
dmesg-fail -> PASS (ro-bdw-i7-5557U)
pass -> DMESG-FAIL (fi-skl-i5-6260u)
pass -> DMESG-FAIL (fi-skl-i7-6700k)
WARNING: Long output truncated
Results at /archive/results/CI_IGT_test/RO_Patchwork_1404/
54c86e3 drm-intel-nightly: 2016y-07m-04d-11h-55m-58s UTC integration manifest
3b1ccef2 drm/i915: Explicitly convert some macros to boolean values
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ✗ Ro.CI.BAT: failure for drm/i915: Explicitly convert some macros to boolean values
2016-07-04 15:26 ` ✗ Ro.CI.BAT: failure for " Patchwork
@ 2016-07-04 15:47 ` Tvrtko Ursulin
0 siblings, 0 replies; 4+ messages in thread
From: Tvrtko Ursulin @ 2016-07-04 15:47 UTC (permalink / raw)
To: intel-gfx
On 04/07/16 16:26, Patchwork wrote:
> == Series Details ==
>
> Series: drm/i915: Explicitly convert some macros to boolean values
> URL : https://patchwork.freedesktop.org/series/9475/
> State : failure
>
> == Summary ==
>
> Series 9475v1 drm/i915: Explicitly convert some macros to boolean values
> http://patchwork.freedesktop.org/api/1.0/series/9475/revisions/1/mbox
>
> Test drv_hangman:
> Subgroup error-state-basic:
> fail -> PASS (ro-skl3-i5-6260u)
> Test drv_module_reload_basic:
> dmesg-fail -> DMESG-WARN (ro-skl3-i5-6260u)
Raised https://bugs.freedesktop.org/show_bug.cgi?id=96805 to stop
logging GuC fw fetch as an error when in fallback mode.
> Test gem_busy:
> Subgroup basic-blt:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-bsd:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-bsd1:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-bsd2:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-parallel-blt:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-parallel-bsd:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-parallel-bsd1:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-parallel-bsd2:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-parallel-render:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-parallel-vebox:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-render:
> skip -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-vebox:
> skip -> PASS (ro-skl3-i5-6260u)
> Test gem_cpu_reloc:
> Subgroup basic:
> fail -> PASS (ro-skl3-i5-6260u)
> Test gem_cs_tlb:
> Subgroup basic-default:
> fail -> PASS (ro-skl3-i5-6260u)
> Test gem_ctx_create:
> Subgroup basic-files:
> fail -> PASS (ro-skl3-i5-6260u)
> Test gem_ctx_exec:
> Subgroup basic:
> fail -> PASS (ro-skl3-i5-6260u)
> Test gem_ctx_switch:
> Subgroup basic-default:
> skip -> PASS (ro-skl3-i5-6260u)
> Test gem_exec_basic:
> Subgroup basic-blt:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-bsd:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-bsd1:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-bsd2:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-default:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-render:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup basic-vebox:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup gtt-blt:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup gtt-bsd:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup gtt-bsd1:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup gtt-bsd2:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup gtt-default:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup gtt-render:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup gtt-vebox:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup readonly-blt:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup readonly-bsd:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup readonly-bsd1:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup readonly-bsd2:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup readonly-default:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup readonly-render:
> fail -> PASS (ro-skl3-i5-6260u)
> Subgroup readonly-vebox:
> fail -> PASS (ro-skl3-i5-6260u)
> Test gem_exec_create:
> Subgroup basic:
> fail -> PASS (ro-skl3-i5-6260u)
> Test gem_exec_flush:
> Subgroup basic-batch-kernel-default-uc:
> fail -> PASS (ro-skl3-i5-6260u)
> dmesg-fail -> PASS (ro-bdw-i7-5557U)
> pass -> DMESG-FAIL (fi-skl-i5-6260u)
> pass -> DMESG-FAIL (fi-skl-i7-6700k)
Filed https://bugs.freedesktop.org/show_bug.cgi?id=96806 for this one.
> WARNING: Long output truncated
>
> Results at /archive/results/CI_IGT_test/RO_Patchwork_1404/
>
> 54c86e3 drm-intel-nightly: 2016y-07m-04d-11h-55m-58s UTC integration manifest
> 3b1ccef2 drm/i915: Explicitly convert some macros to boolean values
>
>
Merged to dinq, thanks for the review!
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-04 15:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-04 14:50 [PATCH] drm/i915: Explicitly convert some macros to boolean values Tvrtko Ursulin
2016-07-04 15:06 ` Chris Wilson
2016-07-04 15:26 ` ✗ Ro.CI.BAT: failure for " Patchwork
2016-07-04 15:47 ` Tvrtko Ursulin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox