[PATCH] drm/i915/gvt: Deliver guest cursor hotspot info

Zhenyu Wang zhenyuw at linux.intel.com
Fri Feb 23 08:12:32 UTC 2018


On 2018.02.23 14:56:06 +0800, Tina Zhang wrote:
> Guest OS driver uses PV info registers to deliver cursor hotspot info
> to host. This patch is used to get cursor hotspot info from virtual
> registers and deliver it to host userspace.
> 
> Signed-off-by: Tina Zhang <tina.zhang at intel.com>
> Cc: Zhenyu Wang <zhenyuw at linux.intel.com>
> Cc: Zhi Wang <zhi.a.wang at intel.com>
> Cc: Gerd Hoffmann <kraxel at redhat.com>
> ---
>  drivers/gpu/drm/i915/gvt/dmabuf.c     | 10 ++++------
>  drivers/gpu/drm/i915/gvt/fb_decoder.c |  2 ++
>  drivers/gpu/drm/i915/gvt/vgpu.c       |  3 +++
>  drivers/gpu/drm/i915/i915_pvinfo.h    |  5 ++++-
>  4 files changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index 9a471b0..ef1937b 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -229,12 +229,10 @@ static int vgpu_get_plane_info(struct drm_device *dev,
>  		info->x_pos = c.x_pos;
>  		info->y_pos = c.y_pos;
>  
> -		/* The invalid cursor hotspot value is delivered to host
> -		 * until we find a way to get the cursor hotspot info of
> -		 * guest OS.
> -		 */
> -		info->x_hot = UINT_MAX;
> -		info->y_hot = UINT_MAX;
> +
> +		info->x_hot = c.x_hot;
> +		info->y_hot = c.y_hot;
> +
>  		info->size = (((info->stride * c.height * c.bpp) / 8)
>  				+ (PAGE_SIZE - 1)) >> PAGE_SHIFT;
>  	} else {
> diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.c b/drivers/gpu/drm/i915/gvt/fb_decoder.c
> index 6b50fe7..80b2caf 100644
> --- a/drivers/gpu/drm/i915/gvt/fb_decoder.c
> +++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c
> @@ -390,6 +390,8 @@ int intel_vgpu_decode_cursor_plane(struct intel_vgpu *vgpu,
>  	plane->y_pos = (val & _CURSOR_POS_Y_MASK) >> _CURSOR_POS_Y_SHIFT;
>  	plane->y_sign = (val & _CURSOR_SIGN_Y_MASK) >> _CURSOR_SIGN_Y_SHIFT;
>  
> +	plane->x_hot = vgpu_vreg(vgpu, 0x78830);
> +	plane->y_hot = vgpu_vreg(vgpu, 0x78834);

Let's not skip formal i915_reg_t definition and have a name for them which
is also required for i915 guest.

>  	return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
> index 41f76e8..027af35 100644
> --- a/drivers/gpu/drm/i915/gvt/vgpu.c
> +++ b/drivers/gpu/drm/i915/gvt/vgpu.c
> @@ -58,6 +58,9 @@ void populate_pvinfo_page(struct intel_vgpu *vgpu)
>  
>  	vgpu_vreg_t(vgpu, vgtif_reg(avail_rs.fence_num)) = vgpu_fence_sz(vgpu);
>  
> +	vgpu_vreg(vgpu, 0x78830) = UINT_MAX;
> +	vgpu_vreg(vgpu, 0x78834) = UINT_MAX;
> +
>  	gvt_dbg_core("Populate PVINFO PAGE for vGPU %d\n", vgpu->id);
>  	gvt_dbg_core("aperture base [GMADR] 0x%llx size 0x%llx\n",
>  		vgpu_aperture_gmadr_base(vgpu), vgpu_aperture_sz(vgpu));
> diff --git a/drivers/gpu/drm/i915/i915_pvinfo.h b/drivers/gpu/drm/i915/i915_pvinfo.h
> index 195203f..9d8dc01 100644
> --- a/drivers/gpu/drm/i915/i915_pvinfo.h
> +++ b/drivers/gpu/drm/i915/i915_pvinfo.h
> @@ -93,7 +93,10 @@ struct vgt_if {
>  	u32 rsv5[4];
>  
>  	u32 g2v_notify;
> -	u32 rsv6[7];
> +	u32 rsv6[5];
> +
> +	u32 xhot;
> +	u32 yhot;

name as cursor_x_hot/cursor_y_hot

Does this have matching info on which pipe this cursor info is for?
Or we always stick with 1 default pipe setup for virtual display?

As this changes i915 file as well, pls include intel-gfx list too.
And better with i915 guest support in the series.

>  
>  	struct {
>  		u32 lo;
> -- 
> 2.7.4
> 

-- 
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-gvt-dev/attachments/20180223/c0411014/attachment.sig>


More information about the intel-gvt-dev mailing list