drm/i915: Eliminate dead code in intel_sanitize_enable_ppgtt()
Subsystems (2)
PATCH 1/1 drm/i915: Eliminate dead code in intel_sanitize_enable_ppgtt()
From: Damien Lespiau <[email protected]>
We exit early if has_aliasing_ppgtt is 0, so towards the end of the function has_aliasing_ppgtt can only be 1.
Also:
if (foo) return 1; else return 0;
when foo is already a bool is really just:
return foo;
v2:
- Simplify more using the fact that i915.enable_execlists requires that GEN >= 8. (Chris)
--- drivers/gpu/drm/i915/i915_gem_gtt.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/i915_gem_gtt.c +9 -5
@@ -133,7 +133,7 @@ static inline void i915_ggtt_invalidate(struct drm_i915_private *i915) }int intel_sanitize_enable_ppgtt (struct drm_i915_private *dev_priv, -int enable_ppgtt) +int enable_ppgtt) {bool has_aliasing_ppgtt;bool has_full_ppgtt;
@@ -180,10 +180,14 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,return 0 ; } -if (INTEL_GEN (dev_priv) >=8 && i915.enable_execlists && has_full_ppgtt) -return has_full_48bit_ppgtt ?3 :2 ; -else -return has_aliasing_ppgtt ?1 :0 ; +if (!has_full_ppgtt) +return 1 ; + +/* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */ +if (!i915.enable_execlists) +return 1 ; + +return has_full_48bit_ppgtt ?3 :2 ; } static int ppgtt_bind_vma(struct i915_vma *vma,
Signature · 6 lines
2.13.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: Eliminate dead code in intel_sanitize_enable_ppgtt() (rev2)
== Series Details ==
== Series Details ==
Series: drm/i915: Eliminate dead code in intel_sanitize_enable_ppgtt() (rev2)
URL : https://patchwork.freedesktop.org/series/8105/
State : success
== Summary ==
Series 8105v2 drm/i915: Eliminate dead code in intel_sanitize_enable_ppgtt()
https://patchwork.freedesktop.org/api/1.0/series/8105/revisions/2/mbox/
Test kms_pipe_crc_basic:
Subgroup hang-read-crc-pipe-a:
pass -> DMESG-WARN (fi-pnv-d510) fdo#101597fdo#101597 https://bugs.freedesktop.org/show_bug.cgi?id=101597
fi-bdw-5557u total:280 pass:269 dwarn:0 dfail:0 fail:0 skip:11 time:455s fi-blb-e6850 total:280 pass:225 dwarn:1 dfail:0 fail:0 skip:54 time:355s fi-bsw-n3050 total:280 pass:244 dwarn:0 dfail:0 fail:0 skip:36 time:539s fi-bxt-j4205 total:280 pass:261 dwarn:0 dfail:0 fail:0 skip:19 time:522s fi-byt-j1900 total:280 pass:255 dwarn:1 dfail:0 fail:0 skip:24 time:492s fi-byt-n2820 total:280 pass:251 dwarn:1 dfail:0 fail:0 skip:28 time:493s fi-glk-2a total:280 pass:261 dwarn:0 dfail:0 fail:0 skip:19 time:597s fi-hsw-4770 total:280 pass:264 dwarn:0 dfail:0 fail:0 skip:16 time:436s fi-hsw-4770r total:280 pass:264 dwarn:0 dfail:0 fail:0 skip:16 time:415s fi-ilk-650 total:280 pass:230 dwarn:0 dfail:0 fail:0 skip:50 time:415s fi-ivb-3520m total:280 pass:262 dwarn:0 dfail:0 fail:0 skip:18 time:506s fi-ivb-3770 total:280 pass:262 dwarn:0 dfail:0 fail:0 skip:18 time:480s fi-kbl-7500u total:280 pass:262 dwarn:0 dfail:0 fail:0 skip:18 time:470s fi-kbl-7560u total:280 pass:270 dwarn:0 dfail:0 fail:0 skip:10 time:717s fi-kbl-r total:280 pass:262 dwarn:0 dfail:0 fail:0 skip:18 time:590s fi-pnv-d510 total:280 pass:222 dwarn:3 dfail:0 fail:0 skip:55 time:571s fi-skl-6260u total:280 pass:270 dwarn:0 dfail:0 fail:0 skip:10 time:460s fi-skl-6700hq total:280 pass:263 dwarn:0 dfail:0 fail:0 skip:17 time:588s fi-skl-6700k total:280 pass:262 dwarn:0 dfail:0 fail:0 skip:18 time:478s fi-skl-6770hq total:280 pass:270 dwarn:0 dfail:0 fail:0 skip:10 time:476s fi-skl-gvtdvm total:280 pass:266 dwarn:1 dfail:0 fail:0 skip:13 time:437s fi-skl-x1585l total:280 pass:269 dwarn:0 dfail:0 fail:0 skip:11 time:489s fi-snb-2520m total:280 pass:252 dwarn:0 dfail:0 fail:0 skip:28 time:558s fi-snb-2600 total:280 pass:251 dwarn:0 dfail:0 fail:0 skip:29 time:409s
fb7cda75b61e4ab4243dad8a23475d1c39ccb333 drm-tip: 2017y-07m-25d-17h-49m-38s UTC integration manifest 683d982b0f27 drm/i915: Eliminate dead code in intel_sanitize_enable_ppgtt()
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5278/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Imre Deak (2017-07-25 22:12:36)
Quoted 48 lines
From: Damien Lespiau <[email protected]>
We exit early if
has_aliasing_ppgttis 0, so towards the end of the functionhas_aliasing_ppgttcan only be 1.Also:
if (foo) return 1; else return 0;when foo is already a bool is really just:
return foo;v2:
- Simplify more using the fact that i915.enable_execlists requires that GEN >= 8. (Chris)Signed-off-by Damien Lespiau <[email protected]>Cc Chris Wilson <[email protected]>[Imre: updated to v2]Signed-off-by Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +1
-4@@ -133,7 +133,7 @@ static inline void i915_ggtt_invalidate(struct drm_i915_private *i915) }int intel_sanitize_enable_ppgtt (struct drm_i915_private *dev_priv, -int enable_ppgtt) +int enable_ppgtt) {bool has_aliasing_ppgtt;bool has_full_ppgtt;@@ -180,10 +180,14 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,return 0 ; } -if (INTEL_GEN (dev_priv) >=8 && i915.enable_execlists && has_full_ppgtt) -return has_full_48bit_ppgtt ?3 :2 ; -else
drivers/gpu/drm/i915/i915_gem_gtt.c int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, · line 191
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +8
-1-return has_aliasing_ppgtt ?1 :0 ; +if (!has_full_ppgtt) +return 1 ; + +/* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */ +if (!i915.enable_execlists) +return 1 ; + +return has_full_48bit_ppgtt ?3 :2 ; }
I was looking at a more complete overhaul, say
nt intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
- int enable_ppgtt)
+ int enable_ppgtt)
{
- bool has_aliasing_ppgtt; - bool has_full_ppgtt; - bool has_full_48bit_ppgtt; + unsigned int min, max;
- has_aliasing_ppgtt = dev_priv->info.has_aliasing_ppgtt;
- has_full_ppgtt = dev_priv->info.has_full_ppgtt;
- has_full_48bit_ppgtt = dev_priv->info.has_full_48bit_ppgtt;
-
- if (intel_vgpu_active(dev_priv)) {
- /* emulation is too hard */
- has_full_ppgtt = false;
- has_full_48bit_ppgtt = false;- }
-
- if (!has_aliasing_ppgtt)
- return 0;
-
- /*
- * We don't allow disabling PPGTT for gen9+ as it's a requirement for - * execlists, the sole mechanism available to submit work. - */
- if (enable_ppgtt == 0 && INTEL_GEN(dev_priv) < 9)
- return 0;
-
- if (enable_ppgtt == 1)
- return 1;
-
- if (enable_ppgtt == 2 && has_full_ppgtt)
- return 2;
-
- if (enable_ppgtt == 3 && has_full_48bit_ppgtt)
- return 3;
+ if (dev_priv->info.has_full_48bit_ppgtt)
+ max = 3;
+ else if (dev_priv->info.has_full_ppgtt)
+ max = 2;
+ else if (dev_priv->info.has_aliasing_ppgtt)
+ max = 1;
+ else
+ max = 0;
/* Disable ppgtt on SNB if VT-d is on. */
if (IS_GEN6(dev_priv) && intel_vtd_active()) {
DRM_INFO("Disabling PPGTT because VT-d is on\n");
- return 0;
+ max = 0;
}
/* Early VLV doesn't have this */
if (IS_VALLEYVIEW(dev_priv) && dev_priv->drm.pdev->revision < 0xb) {
DRM_DEBUG_DRIVER("disabling PPGTT on pre-B3 step VLV\n");
- return 0;
+ max = 0;
}- if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists && has_full_ppgtt)
- return has_full_48bit_ppgtt ? 3 : 2;
- else
- return has_aliasing_ppgtt ? 1 : 0;
+ /* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */
+ if (!i915.enable_execlists)
+ max = min(max, 1u);
+
+ /* emulation of full-ppgtt is too hard */
+ if (intel_vgpu_active(dev_priv))
+ max = min(max, 1u);
+
+ /*
+ * We don't allow disabling PPGTT for gen9+ as it's a requirement for + * execlists, the sole mechanism available to submit work. + */
+ min = 0;
+ if (INTEL_GEN(dev_priv) >= 9)
+ min = 1;
+
+ return clamp_t(unsigned int, enable_ppgtt, min, max);
}
static int ppgtt_bind_vma(struct i915_vma *vma,
i.e.
int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,
int enable_ppgtt)
{
unsigned int min, max;
if (dev_priv->info.has_full_48bit_ppgtt)
max = 3;
else if (dev_priv->info.has_full_ppgtt)
max = 2;
else if (dev_priv->info.has_aliasing_ppgtt)
max = 1;
else
max = 0;
/* Disable ppgtt on SNB if VT-d is on. */
if (IS_GEN6(dev_priv) && intel_vtd_active()) {
DRM_INFO("Disabling PPGTT because VT-d is on\n");
max = 0;
}
/* Early VLV doesn't have this */
if (IS_VALLEYVIEW(dev_priv) && dev_priv->drm.pdev->revision < 0xb) {
DRM_DEBUG_DRIVER("disabling PPGTT on pre-B3 step VLV\n");
max = 0;
}
/* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */
if (!i915.enable_execlists)
max = min(max, 1u);
/* emulation of full-ppgtt is too hard */
if (intel_vgpu_active(dev_priv))
max = min(max, 1u);
/*
* We don't allow disabling PPGTT for gen9+ as it's a requirement for
* execlists, the sole mechanism available to submit work.
*/
min = 0;
if (INTEL_GEN(dev_priv) >= 9)
min = 1;
return clamp_t(unsigned int, enable_ppgtt, min, max);
}_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Yep, looks better in the end. If you could send a proper patch I'd review it.
Quoted 186 lines · Chris Wilson
Quoting Imre Deak (2017-07-25 22:12:36)
Quoted 48 lines
From: Damien Lespiau <[email protected]>
We exit early if
has_aliasing_ppgttis 0, so towards the end of the functionhas_aliasing_ppgttcan only be 1.Also:
if (foo) return 1; else return 0;when foo is already a bool is really just:
return foo;v2:
- Simplify more using the fact that i915.enable_execlists requires that GEN >= 8. (Chris)Signed-off-by Damien Lespiau <[email protected]>Cc Chris Wilson <[email protected]>[Imre: updated to v2]Signed-off-by Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_gem_gtt.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/i915_gem_gtt.c +1
-4@@ -133,7 +133,7 @@ static inline void i915_ggtt_invalidate(struct drm_i915_private *i915) }int intel_sanitize_enable_ppgtt (struct drm_i915_private *dev_priv, -int enable_ppgtt) +int enable_ppgtt) {bool has_aliasing_ppgtt;bool has_full_ppgtt;@@ -180,10 +180,14 @@ int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv,return 0 ; } -if (INTEL_GEN (dev_priv) >=8 && i915.enable_execlists && has_full_ppgtt) -return has_full_48bit_ppgtt ?3 :2 ; -else drivers/gpu/drm/i915/i915_gem_gtt.c int intel_sanitize_enable_ppgtt(struct drm_i915_private *dev_priv, · line 191
Quoted 10 lines
drivers/gpu/drm/i915/i915_gem_gtt.c +8
-1-return has_aliasing_ppgtt ?1 :0 ; +if (!has_full_ppgtt) +return 1 ; + +/* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */ +if (!i915.enable_execlists) +return 1 ; + +return has_full_48bit_ppgtt ?3 :2 ; }I was looking at a more complete overhaul, say
nt intel_sanitize_enable_ppgtt(struct
drm_i915_private*dev_priv,(quoted diff) +29
-38- int enable_ppgtt) + int enable_ppgtt) { - bool has_aliasing_ppgtt; - bool has_full_ppgtt; - bool has_full_48bit_ppgtt; + unsigned int min, max; - has_aliasing_ppgtt = dev_priv->info.has_aliasing_ppgtt; - has_full_ppgtt = dev_priv->info.has_full_ppgtt; - has_full_48bit_ppgtt = dev_priv->info.has_full_48bit_ppgtt; - - if (intel_vgpu_active(dev_priv)) { - /* emulation is too hard */ - has_full_ppgtt = false; - has_full_48bit_ppgtt = false; - } - - if (!has_aliasing_ppgtt) - return 0; - - /* - * We don't allow disabling PPGTT for gen9+ as it's a requirement for - * execlists, the sole mechanism available to submit work. - */ - if (enable_ppgtt == 0 && INTEL_GEN(dev_priv) < 9) - return 0; - - if (enable_ppgtt == 1) - return 1; - - if (enable_ppgtt == 2 && has_full_ppgtt) - return 2; - - if (enable_ppgtt == 3 && has_full_48bit_ppgtt) - return 3; + if (dev_priv->info.has_full_48bit_ppgtt) + max = 3; + else if (dev_priv->info.has_full_ppgtt) + max = 2; + else if (dev_priv->info.has_aliasing_ppgtt) + max = 1; + else + max = 0; /* Disable ppgtt on SNB if VT-d is on. */ if (IS_GEN6(dev_priv) && intel_vtd_active()) { DRM_INFO("Disabling PPGTT because VT-d is on\n"); - return 0; + max = 0; } /* Early VLV doesn't have this */ if (IS_VALLEYVIEW(dev_priv) && dev_priv->drm.pdev->revision < 0xb) { DRM_DEBUG_DRIVER("disabling PPGTT on pre-B3 step VLV\n"); - return 0; + max = 0; } - if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists && has_full_ppgtt) - return has_full_48bit_ppgtt ? 3 : 2; - else - return has_aliasing_ppgtt ? 1 : 0; + /* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */ + if (!i915.enable_execlists) + max = min(max, 1u); + + /* emulation of full-ppgtt is too hard */ + if (intel_vgpu_active(dev_priv)) + max = min(max, 1u); + + /* + * We don't allow disabling PPGTT for gen9+ as it's a requirement for + * execlists, the sole mechanism available to submit work. + */ + min = 0; + if (INTEL_GEN(dev_priv) >= 9) + min = 1; + + return clamp_t(unsigned int, enable_ppgtt, min, max); } static int ppgtt_bind_vma(struct i915_vma *vma,i.e.
int intel_sanitize_enable_ppgtt(struct
drm_i915_private*dev_priv,
intenable_ppgtt){ unsigned int min, max; if (dev_priv->info.has_full_48bit_ppgtt) max = 3; else if (dev_priv->info.has_full_ppgtt) max = 2; else if (dev_priv->info.has_aliasing_ppgtt) max = 1; else max = 0; /* Disable ppgtt on SNB if VT-d is on. */ if (IS_GEN6(dev_priv) && intel_vtd_active()) { DRM_INFO("Disabling PPGTT because VT-d is on\n"); max = 0; } /* Early VLV doesn't have this */ if (IS_VALLEYVIEW(dev_priv) && dev_priv->drm.pdev->revision < 0xb) { DRM_DEBUG_DRIVER("disabling PPGTT on pre-B3 step VLV\n"); max = 0; } /* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */ if (!i915.enable_execlists) max = min(max, 1u); /* emulation of full-ppgtt is too hard */ if (intel_vgpu_active(dev_priv)) max = min(max, 1u); /* * We don't allow disabling PPGTT for gen9+ as it's a requirement for
Quoted 8 lines
* execlists, the sole mechanism available to submit work.
*/
min = 0;
if (INTEL_GEN(dev_priv) >= 9)
min = 1;
return clamp_t(unsigned int, enable_ppgtt, min, max);
}_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Chris, as we're ready to enable 48bit full ppgtt for guest, so patch like
https://patchwork.freedesktop.org/patch/162507/ will change this part too. I'd like you to send this one, so Tina can refresh against this to apply.
Thanks
Quoted 139 lines · Chris Wilson
I was looking at a more complete overhaul, say
nt intel_sanitize_enable_ppgtt(struct
drm_i915_private*dev_priv,(quoted diff) +29
-38- int enable_ppgtt) + int enable_ppgtt) { - bool has_aliasing_ppgtt; - bool has_full_ppgtt; - bool has_full_48bit_ppgtt; + unsigned int min, max; - has_aliasing_ppgtt = dev_priv->info.has_aliasing_ppgtt; - has_full_ppgtt = dev_priv->info.has_full_ppgtt; - has_full_48bit_ppgtt = dev_priv->info.has_full_48bit_ppgtt; - - if (intel_vgpu_active(dev_priv)) { - /* emulation is too hard */ - has_full_ppgtt = false; - has_full_48bit_ppgtt = false; - } - - if (!has_aliasing_ppgtt) - return 0; - - /* - * We don't allow disabling PPGTT for gen9+ as it's a requirement for - * execlists, the sole mechanism available to submit work. - */ - if (enable_ppgtt == 0 && INTEL_GEN(dev_priv) < 9) - return 0; - - if (enable_ppgtt == 1) - return 1; - - if (enable_ppgtt == 2 && has_full_ppgtt) - return 2; - - if (enable_ppgtt == 3 && has_full_48bit_ppgtt) - return 3; + if (dev_priv->info.has_full_48bit_ppgtt) + max = 3; + else if (dev_priv->info.has_full_ppgtt) + max = 2; + else if (dev_priv->info.has_aliasing_ppgtt) + max = 1; + else + max = 0; /* Disable ppgtt on SNB if VT-d is on. */ if (IS_GEN6(dev_priv) && intel_vtd_active()) { DRM_INFO("Disabling PPGTT because VT-d is on\n"); - return 0; + max = 0; } /* Early VLV doesn't have this */ if (IS_VALLEYVIEW(dev_priv) && dev_priv->drm.pdev->revision < 0xb) { DRM_DEBUG_DRIVER("disabling PPGTT on pre-B3 step VLV\n"); - return 0; + max = 0; } - if (INTEL_GEN(dev_priv) >= 8 && i915.enable_execlists && has_full_ppgtt) - return has_full_48bit_ppgtt ? 3 : 2; - else - return has_aliasing_ppgtt ? 1 : 0; + /* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */ + if (!i915.enable_execlists) + max = min(max, 1u); + + /* emulation of full-ppgtt is too hard */ + if (intel_vgpu_active(dev_priv)) + max = min(max, 1u); + + /* + * We don't allow disabling PPGTT for gen9+ as it's a requirement for + * execlists, the sole mechanism available to submit work. + */ + min = 0; + if (INTEL_GEN(dev_priv) >= 9) + min = 1; + + return clamp_t(unsigned int, enable_ppgtt, min, max); } static int ppgtt_bind_vma(struct i915_vma *vma,i.e.
int intel_sanitize_enable_ppgtt(struct
drm_i915_private*dev_priv,
intenable_ppgtt){ unsigned int min, max; if (dev_priv->info.has_full_48bit_ppgtt) max = 3; else if (dev_priv->info.has_full_ppgtt) max = 2; else if (dev_priv->info.has_aliasing_ppgtt) max = 1; else max = 0; /* Disable ppgtt on SNB if VT-d is on. */ if (IS_GEN6(dev_priv) && intel_vtd_active()) { DRM_INFO("Disabling PPGTT because VT-d is on\n"); max = 0; } /* Early VLV doesn't have this */ if (IS_VALLEYVIEW(dev_priv) && dev_priv->drm.pdev->revision < 0xb) { DRM_DEBUG_DRIVER("disabling PPGTT on pre-B3 step VLV\n"); max = 0; } /* full-ppgtt doesn't yet work reliably in legacy ringbuffer mode */ if (!i915.enable_execlists) max = min(max, 1u); /* emulation of full-ppgtt is too hard */ if (intel_vgpu_active(dev_priv)) max = min(max, 1u); /* * We don't allow disabling PPGTT for gen9+ as it's a requirement for * execlists, the sole mechanism available to submit work. */ min = 0; if (INTEL_GEN(dev_priv) >= 9) min = 1; return clamp_t(unsigned int, enable_ppgtt, min, max); }_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 3 lines
Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx