Re: [PATCH] drm/i915: Fix the frame buffer fence starvation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Guang Bai (2018-02-20 11:41:03)
> Currently a tiled frame buffer to be scanned out is always installed
> with a fence, leading to fence starvation on gen9lp virtualization
> use case where graphics stacks of service and guest OSes compete for
> fences.
> 
> By design, this fence is always needed by i965-(GEN4-) platforms.
> For GEN4 and above, the fence is only required when the frame buffer
> compression is enabled.
> 
> Changes are made to follow graphics hardware design principles.
> 
> Signed-off-by: Guang Bai <guang.bai@xxxxxxxxx>
> ---
> @@ -2105,13 +2108,19 @@ intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, unsigned int rotation)
>         vma = i915_gem_object_pin_to_display_plane(obj, alignment, &view);
>         if (IS_ERR(vma))
>                 goto err;
> +       /*
> +        * Install the fence for pre-i965(GEN4-) tiled frame buffers all the
> +        * time but only do it for i965(GEN4) and beyond when the frame buffer
> +        * compression is enabled during boot up or runtime.
> +        */
> +       intel_plane = to_intel_plane(plane);
> +       if (INTEL_GEN(dev_priv) < 4 || (intel_fbc_can_enable(dev_priv) &&
> +               (pipe == PIPE_A) && intel_plane &&
> +               (intel_plane->id == PLANE_PRIMARY)))
> +               needs_fence = true;

It is a bit more complicated than this. If the same vma is shared
between multiple pipes, then it needs the compound requirements of all.
Push this decision out to the caller. (When policy is difficult, punt.)

>         if (i915_vma_is_map_and_fenceable(vma)) {
> -               /* Install a fence for tiled scan-out. Pre-i965 always needs a
> -                * fence, whereas 965+ only requires a fence if using
> -                * framebuffer compression.  For simplicity, we always, when
> -                * possible, install a fence as the cost is not that onerous.
> -                *
> +               /*
>                  * If we fail to fence the tiled scanout, then either the
>                  * modeset will reject the change (which is highly unlikely as
>                  * the affected systems, all but one, do not have unmappable
> @@ -2123,7 +2132,16 @@ intel_pin_and_fence_fb_obj(struct drm_framebuffer *fb, unsigned int rotation)
>                  * something and try to run the system in a "less than optimal"
>                  * mode that matches the user configuration.
>                  */
> -               i915_vma_pin_fence(vma);
> +               if (needs_fence)
> +                       i915_vma_pin_fence(vma);
> +               else if (vma->fence)
> +                       /*
> +                        * For a reused fence, increase its ref count even if
> +                        * it's not pinned to maintain the count consistancy.
> +                        * This is because the count is unconditionally 
> +                        * decreased when the fence is unpinned.
> +                        */
> +                       vma->fence->pin_count++;

Fixed in tip.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux