[Intel-gfx] [PATCH 2/8] drm/i915: Specify bsd rings through exec flag

Rodrigo Vivi rodrigo.vivi at gmail.com
Fri Nov 14 01:54:24 CET 2014


On Mon, Nov 10, 2014 at 4:52 AM, Rodrigo Vivi <rodrigo.vivi at intel.com> wrote:
> From: Zhipeng Gong <zhipeng.gong at intel.com>
>
> On Broadwell GT3 we have 2 Video Command Streamers (VCS), but userspace
> has no control when using VCS1 or VCS2. This patch introduces a mechanism
> to avoid the default ping-pong mode and use one specific ring through
> execution flag.
>
> v2: fix whitespace (Rodrigo)
>
> Signed-off-by: Zhipeng Gong <zhipeng.gong at intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_execbuffer.c | 19 +++++++++++++++++--
>  drivers/gpu/drm/i915/intel_dp.c            |  3 +++
>  include/uapi/drm/i915_drm.h                |  8 +++++++-
>  3 files changed, 27 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index e1ed85a..d9081ec 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -1273,8 +1273,23 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
>         else if ((args->flags & I915_EXEC_RING_MASK) == I915_EXEC_BSD) {
>                 if (HAS_BSD2(dev)) {
>                         int ring_id;
> -                       ring_id = gen8_dispatch_bsd_ring(dev, file);
> -                       ring = &dev_priv->ring[ring_id];
> +
> +                       switch (args->flags & I915_EXEC_BSD_MASK) {
> +                       case I915_EXEC_BSD_DEFAULT:
> +                               ring_id = gen8_dispatch_bsd_ring(dev, file);
> +                               ring = &dev_priv->ring[ring_id];
> +                               break;
> +                       case I915_EXEC_BSD_RING1:
> +                               ring = &dev_priv->ring[VCS];
> +                               break;
> +                       case I915_EXEC_BSD_RING2:
> +                               ring = &dev_priv->ring[VCS2];
> +                               break;
> +                       default:
> +                               DRM_DEBUG("execbuf with unknown bsd ring: %d\n",
> +                                         (int)(args->flags & I915_EXEC_BSD_MASK));
> +                               return -EINVAL;
> +                       }
>                 } else
>                         ring = &dev_priv->ring[VCS];
>         } else
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index ceb528f..a8c9e47 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -4802,6 +4802,9 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
>                 if (HAS_PCH_SPLIT(dev)) {
>                         if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
>                                 goto mst_fail;
> +               if (!intel_dp->output_reg)
> +                       goto mst_fail;
> +

I think this shouldn't be here

>                 } else {
>                         if (g4x_digital_port_connected(dev, intel_dig_port) != 1)
>                                 goto mst_fail;
> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
> index 2502622..fcb16bf 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -737,7 +737,13 @@ struct drm_i915_gem_execbuffer2 {
>   */
>  #define I915_EXEC_HANDLE_LUT           (1<<12)
>
> -#define __I915_EXEC_UNKNOWN_FLAGS -(I915_EXEC_HANDLE_LUT<<1)
> +/** Used for switching BSD rings on the platforms with two BSD rings */
> +#define I915_EXEC_BSD_MASK             (3<<13)
> +#define I915_EXEC_BSD_DEFAULT          (0<<13) /* default ping-pong mode */
> +#define I915_EXEC_BSD_RING1            (1<<13)
> +#define I915_EXEC_BSD_RING2            (2<<13)
> +
> +#define __I915_EXEC_UNKNOWN_FLAGS -(1<<15)

This is inverted and using one bit more than needed.
Should be -(14<<1) right?!

>
>  #define I915_EXEC_CONTEXT_ID_MASK      (0xffffffff)
>  #define i915_execbuffer2_set_context_id(eb2, context) \
> --
> 1.9.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx



-- 
Rodrigo Vivi
Blog: http://blog.vivi.eng.br



More information about the Intel-gfx mailing list