[Intel-gfx] [PATCH] drm/i915: Eliminate dead code in intel_sanitize_enable_ppgtt()

Zhenyu Wang zhenyuw at linux.intel.com
Fri Jul 28 02:32:24 UTC 2017


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

On 2017.07.26 15:44:00 +0100, Chris Wilson wrote:
> 
> 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
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20170728/46e8cfb6/attachment-0001.sig>


More information about the Intel-gfx mailing list