Re: [Intel-gfx] [PATCH v2 3/6] drm/i915: Add NV12 as supported format for sprite plane

2018-04-15 Thread Srinivas, Vidya
Thank you so much. I had included your name also under credits-to
I will add your RB before merging.

Regards
Vidya

> -Original Message-
> From: Kristian Høgsberg [mailto:hoegsb...@gmail.com]
> Sent: Friday, April 13, 2018 9:44 PM
> To: Srinivas, Vidya 
> Cc: intel-gfx@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH v2 3/6] drm/i915: Add NV12 as supported
> format for sprite plane
> 
> On Fri, Apr 13, 2018 at 5:18 AM Vidya Srinivas 
> wrote:
> 
> > From: Chandra Konduru 
> 
> > This patch adds NV12 to list of supported formats for sprite plane.
> 
> > v2: Rebased (me)
> 
> > v3: Review comments by Ville addressed
> > - Removed skl_plane_formats_with_nv12 and added
> > NV12 case in existing skl_plane_formats
> > - Added the 10bpc RGB formats
> 
> > v4: Addressed review comments from Clinton A Taylor "Why are we
> adding
> > 10 bit RGB formats with the NV12 series patches?
> > Trying to set XR30 or AB30 results in error returned even though the
> > modes are advertised for the planes"
> > - Removed 10bit RGB formats added previously with NV12 series
> 
> > v5: Missed the Tested-by/Reviewed-by in the previous series Adding the
> > same to commit message in this version.
> > Addressed review comments from Clinton A Taylor "Why are we adding 10
> > bit RGB formats with the NV12 series patches?
> > Trying to set XR30 or AB30 results in error returned even though the
> > modes are advertised for the planes"
> > - Previous version has 10bit RGB format removed from VLV formats by
> > mistake. Fixing that in this version.
> > Removed 10bit RGB formats added previously with NV12 series for SKL.
> 
> > v6: Addressed review comments by Ville Restricting the NV12 to BXT and
> > PIPE A and B
> 
> > v7: Rebased (me)
> 
> > v8: Rebased (me)
> > Restricting NV12 changes to BXT and KBL Restricting NV12 changes for
> > plane 0 (overlay)
> 
> > v9: Rebased (me)
> 
> > v10: Addressed review comments from Maarten.
> > Adding NV12 to skl_plane_formats itself.
> 
> > v11: Addressed review comments from Shashank Sharma
> 
> > v12: Addressed review comments from Shashank Sharma Made the
> condition
> > in intel_sprite_plane_create simple and easy to read as suggested.
> 
> > v13: Adding reviewed by tag from Shashank Sharma Addressed review
> > comments from Juha-Pekka Heikkila
> > "NV12 not to be supported by SKL"
> 
> > v14: Addressed review comments from Ville Added skl_planar_formats to
> > include NV12 and a check skl_plane_has_planar in sprite create Added
> > NV12 format to skl_mod_supported. These were review comments from
> > Kristian Høgsberg 
> 
> > v15: Added reviewed by from Juha-Pekka Heikkila
> 
> > v16: Rebased the series
> 
> > v17: Added all tiling under mod supported for NV12 Credits to Megha
> > Aggarwal
> 
> > Credits-to: Megha Aggarwal 
> > Credits-to: Kristian Høgsberg 
> > Tested-by: Clinton Taylor 
> > Reviewed-by: Juha-Pekka Heikkila 
> > Reviewed-by: Shashank Sharma 
> > Reviewed-by: Clinton Taylor 
> > Signed-off-by: Chandra Konduru 
> > Signed-off-by: Nabendu Maiti 
> > Signed-off-by: Vidya Srinivas 
> > ---
> >   drivers/gpu/drm/i915/intel_sprite.c | 29
> +++--
> >   1 file changed, 27 insertions(+), 2 deletions(-)
> 
> > diff --git a/drivers/gpu/drm/i915/intel_sprite.c
> b/drivers/gpu/drm/i915/intel_sprite.c
> > index aa1dfaa..8b7947d 100644
> > --- a/drivers/gpu/drm/i915/intel_sprite.c
> > +++ b/drivers/gpu/drm/i915/intel_sprite.c
> > @@ -1253,6 +1253,19 @@ static uint32_t skl_plane_formats[] = {
> >  DRM_FORMAT_VYUY,
> >   };
> 
> > +static uint32_t skl_planar_formats[] = {
> > +   DRM_FORMAT_RGB565,
> > +   DRM_FORMAT_ABGR,
> > +   DRM_FORMAT_ARGB,
> > +   DRM_FORMAT_XBGR,
> > +   DRM_FORMAT_XRGB,
> > +   DRM_FORMAT_YUYV,
> > +   DRM_FORMAT_YVYU,
> > +   DRM_FORMAT_UYVY,
> > +   DRM_FORMAT_VYUY,
> > +   DRM_FORMAT_NV12,
> > +};
> > +
> >   static const uint64_t skl_plane_format_modifiers_noccs[] = {
> >  I915_FORMAT_MOD_Yf_TILED,
> >  I915_FORMAT_MOD_Y_TILED,
> > @@ -1350,6 +1363,12 @@ static bool skl_mod_supported(uint32_t
> format,
> uint64_t modifier)
> >  if (modifier == I915_FORMAT_MOD_Yf_TILED)
> >  return true;
> >  /* fall through */
> > +   case DRM_FORMAT_NV12:
> > +   if (modifier == DRM_FORMAT_MOD_LINEAR ||
> > +   modifier == I915_FORMAT_MOD_X_TILED ||
> > +   modifier == I915_FORMAT_MOD_Y_TILED ||
> > +   modifier == I915_FORMAT_MOD_Yf_TILED)
> > +   return true;
> 
> Thanks for adding the modifier support.
> 
> Reviewed-by: Kristian H. Kristensen 
> 
> >  case DRM_FORMAT_C8:
> >  if (modifier == DRM_FORMAT_MOD_LINEAR ||
> >  modifier == I915_FORMAT_MOD_X_TILED || @@ -1446,8
> > +1465,14 @@ intel_sprite_plane_create(struct drm_i915_private
> *dev_priv,
> >  intel_plane->d

[Intel-gfx] [PATCH v3] drm/i915/gvt: Deliver guest cursor hotspot info

2018-04-15 Thread Tina Zhang
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.

v3->v4:
- Return UINT_MAX when x_hot/y_hot is invalid. (Zhenyu)

v2->v3:
- add validate_hotspot(). (Zhenyu)

v1->v2:
- name as cursor_x_hot/cursor_y_hot. (Zhenyu)
- use i915_reg_t definition instead of magic numbers. (Zhenyu)

Signed-off-by: Tina Zhang 
Cc: Zhenyu Wang 
Cc: Zhi Wang 
Cc: Gerd Hoffmann 
---
 drivers/gpu/drm/i915/gvt/dmabuf.c | 22 --
 drivers/gpu/drm/i915/gvt/fb_decoder.c |  3 +++
 drivers/gpu/drm/i915/gvt/handlers.c   |  4 ++--
 drivers/gpu/drm/i915/gvt/vgpu.c   |  3 +++
 drivers/gpu/drm/i915/i915_pvinfo.h|  5 -
 5 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c 
b/drivers/gpu/drm/i915/gvt/dmabuf.c
index 6f4f8e9..a7c7082 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -192,6 +192,14 @@ static struct drm_i915_gem_object *vgpu_create_gem(struct 
drm_device *dev,
return obj;
 }
 
+static bool validate_hotspot(struct intel_vgpu_cursor_plane_format *c)
+{
+   if (c && (c->x_hot <= c->width) && (c->y_hot <= c->height))
+   return true;
+   else
+   return false;
+}
+
 static int vgpu_get_plane_info(struct drm_device *dev,
struct intel_vgpu *vgpu,
struct intel_vgpu_fb_info *info,
@@ -229,12 +237,14 @@ 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;
+   if (validate_hotspot(&c)) {
+   info->x_hot = c.x_hot;
+   info->y_hot = c.y_hot;
+   } else {
+   info->x_hot = UINT_MAX;
+   info->y_hot = UINT_MAX;
+   }
+
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 1c12068..5e7468b 100644
--- a/drivers/gpu/drm/i915/gvt/fb_decoder.c
+++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c
@@ -36,6 +36,7 @@
 #include 
 #include "i915_drv.h"
 #include "gvt.h"
+#include "i915_pvinfo.h"
 
 #define PRIMARY_FORMAT_NUM 16
 struct pixel_format {
@@ -384,6 +385,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_t(vgpu, vgtif_reg(cursor_x_hot));
+   plane->y_hot = vgpu_vreg_t(vgpu, vgtif_reg(cursor_y_hot));
return 0;
 }
 
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c 
b/drivers/gpu/drm/i915/gvt/handlers.c
index a33c1c3e..2c824a9 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -1201,8 +1201,8 @@ static int pvinfo_mmio_write(struct intel_vgpu *vgpu, 
unsigned int offset,
ret = handle_g2v_notification(vgpu, data);
break;
/* add xhot and yhot to handled list to avoid error log */
-   case 0x78830:
-   case 0x78834:
+   case _vgtif_reg(cursor_x_hot):
+   case _vgtif_reg(cursor_y_hot):
case _vgtif_reg(pdp[0].lo):
case _vgtif_reg(pdp[0].hi):
case _vgtif_reg(pdp[1].lo):
diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index 2e0a02a..bf75300 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_t(vgpu, vgtif_reg(cursor_x_hot)) = UINT_MAX;
+   vgpu_vreg_t(vgpu, vgtif_reg(cursor_y_hot)) = 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..d61914a 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 cursor_x_hot;
+   u32 cursor_y_hot;
 
struct {
u32 lo;
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
htt

[Intel-gfx] [PATCH v4] drm/i915/gvt: Deliver guest cursor hotspot info

2018-04-15 Thread Tina Zhang
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.

v3->v4:
- return UINT_MAX when x_hot/y_hot is invalid. (Zhenyu)
- correct version.

v2->v3:
- add validate_hotspot(). (Zhenyu)

v1->v2:
- name as cursor_x_hot/cursor_y_hot. (Zhenyu)
- use i915_reg_t definition instead of magic numbers. (Zhenyu)

Signed-off-by: Tina Zhang 
Cc: Zhenyu Wang 
Cc: Zhi Wang 
Cc: Gerd Hoffmann 
---
 drivers/gpu/drm/i915/gvt/dmabuf.c | 22 --
 drivers/gpu/drm/i915/gvt/fb_decoder.c |  3 +++
 drivers/gpu/drm/i915/gvt/handlers.c   |  4 ++--
 drivers/gpu/drm/i915/gvt/vgpu.c   |  3 +++
 drivers/gpu/drm/i915/i915_pvinfo.h|  5 -
 5 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c 
b/drivers/gpu/drm/i915/gvt/dmabuf.c
index 6f4f8e9..a7c7082 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -192,6 +192,14 @@ static struct drm_i915_gem_object *vgpu_create_gem(struct 
drm_device *dev,
return obj;
 }
 
+static bool validate_hotspot(struct intel_vgpu_cursor_plane_format *c)
+{
+   if (c && (c->x_hot <= c->width) && (c->y_hot <= c->height))
+   return true;
+   else
+   return false;
+}
+
 static int vgpu_get_plane_info(struct drm_device *dev,
struct intel_vgpu *vgpu,
struct intel_vgpu_fb_info *info,
@@ -229,12 +237,14 @@ 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;
+   if (validate_hotspot(&c)) {
+   info->x_hot = c.x_hot;
+   info->y_hot = c.y_hot;
+   } else {
+   info->x_hot = UINT_MAX;
+   info->y_hot = UINT_MAX;
+   }
+
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 1c12068..5e7468b 100644
--- a/drivers/gpu/drm/i915/gvt/fb_decoder.c
+++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c
@@ -36,6 +36,7 @@
 #include 
 #include "i915_drv.h"
 #include "gvt.h"
+#include "i915_pvinfo.h"
 
 #define PRIMARY_FORMAT_NUM 16
 struct pixel_format {
@@ -384,6 +385,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_t(vgpu, vgtif_reg(cursor_x_hot));
+   plane->y_hot = vgpu_vreg_t(vgpu, vgtif_reg(cursor_y_hot));
return 0;
 }
 
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c 
b/drivers/gpu/drm/i915/gvt/handlers.c
index a33c1c3e..2c824a9 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -1201,8 +1201,8 @@ static int pvinfo_mmio_write(struct intel_vgpu *vgpu, 
unsigned int offset,
ret = handle_g2v_notification(vgpu, data);
break;
/* add xhot and yhot to handled list to avoid error log */
-   case 0x78830:
-   case 0x78834:
+   case _vgtif_reg(cursor_x_hot):
+   case _vgtif_reg(cursor_y_hot):
case _vgtif_reg(pdp[0].lo):
case _vgtif_reg(pdp[0].hi):
case _vgtif_reg(pdp[1].lo):
diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
index 2e0a02a..bf75300 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_t(vgpu, vgtif_reg(cursor_x_hot)) = UINT_MAX;
+   vgpu_vreg_t(vgpu, vgtif_reg(cursor_y_hot)) = 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..d61914a 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 cursor_x_hot;
+   u32 cursor_y_hot;
 
struct {
u32 lo;
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.

Re: [Intel-gfx] [PATCH v4] drm/i915/gvt: Deliver guest cursor hotspot info

2018-04-15 Thread Zhenyu Wang
On 2018.04.16 13:51:38 +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.
> 
> v3->v4:
> - return UINT_MAX when x_hot/y_hot is invalid. (Zhenyu)
> - correct version.
> 
> v2->v3:
> - add validate_hotspot(). (Zhenyu)
> 
> v1->v2:
> - name as cursor_x_hot/cursor_y_hot. (Zhenyu)
> - use i915_reg_t definition instead of magic numbers. (Zhenyu)
> 
> Signed-off-by: Tina Zhang 
> Cc: Zhenyu Wang 
> Cc: Zhi Wang 
> Cc: Gerd Hoffmann 
> ---
>  drivers/gpu/drm/i915/gvt/dmabuf.c | 22 --
>  drivers/gpu/drm/i915/gvt/fb_decoder.c |  3 +++
>  drivers/gpu/drm/i915/gvt/handlers.c   |  4 ++--
>  drivers/gpu/drm/i915/gvt/vgpu.c   |  3 +++
>  drivers/gpu/drm/i915/i915_pvinfo.h|  5 -
>  5 files changed, 28 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c 
> b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index 6f4f8e9..a7c7082 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -192,6 +192,14 @@ static struct drm_i915_gem_object 
> *vgpu_create_gem(struct drm_device *dev,
>   return obj;
>  }
>  
> +static bool validate_hotspot(struct intel_vgpu_cursor_plane_format *c)
> +{
> + if (c && (c->x_hot <= c->width) && (c->y_hot <= c->height))
> + return true;

No way c could be NULL here.

> + else
> + return false;
> +}
> +
>  static int vgpu_get_plane_info(struct drm_device *dev,
>   struct intel_vgpu *vgpu,
>   struct intel_vgpu_fb_info *info,
> @@ -229,12 +237,14 @@ 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;
> + if (validate_hotspot(&c)) {
> + info->x_hot = c.x_hot;
> + info->y_hot = c.y_hot;
> + } else {
> + info->x_hot = UINT_MAX;
> + info->y_hot = UINT_MAX;
> + }
> +
>   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 1c12068..5e7468b 100644
> --- a/drivers/gpu/drm/i915/gvt/fb_decoder.c
> +++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c
> @@ -36,6 +36,7 @@
>  #include 
>  #include "i915_drv.h"
>  #include "gvt.h"
> +#include "i915_pvinfo.h"
>  
>  #define PRIMARY_FORMAT_NUM   16
>  struct pixel_format {
> @@ -384,6 +385,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_t(vgpu, vgtif_reg(cursor_x_hot));
> + plane->y_hot = vgpu_vreg_t(vgpu, vgtif_reg(cursor_y_hot));
>   return 0;
>  }
>  
> diff --git a/drivers/gpu/drm/i915/gvt/handlers.c 
> b/drivers/gpu/drm/i915/gvt/handlers.c
> index a33c1c3e..2c824a9 100644
> --- a/drivers/gpu/drm/i915/gvt/handlers.c
> +++ b/drivers/gpu/drm/i915/gvt/handlers.c
> @@ -1201,8 +1201,8 @@ static int pvinfo_mmio_write(struct intel_vgpu *vgpu, 
> unsigned int offset,
>   ret = handle_g2v_notification(vgpu, data);
>   break;
>   /* add xhot and yhot to handled list to avoid error log */
> - case 0x78830:
> - case 0x78834:
> + case _vgtif_reg(cursor_x_hot):
> + case _vgtif_reg(cursor_y_hot):
>   case _vgtif_reg(pdp[0].lo):
>   case _vgtif_reg(pdp[0].hi):
>   case _vgtif_reg(pdp[1].lo):
> diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c
> index 2e0a02a..bf75300 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_t(vgpu, vgtif_reg(cursor_x_hot)) = UINT_MAX;
> + vgpu_vreg_t(vgpu, vgtif_reg(cursor_y_hot)) = 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..d61914a 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

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/gvt: Deliver guest cursor hotspot info (rev2)

2018-04-15 Thread Patchwork
== Series Details ==

Series: drm/i915/gvt: Deliver guest cursor hotspot info (rev2)
URL   : https://patchwork.freedesktop.org/series/41727/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
28bd5550e843 drm/i915/gvt: Deliver guest cursor hotspot info
-:36: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'c->x_hot 
<= c->width'
#36: FILE: drivers/gpu/drm/i915/gvt/dmabuf.c:197:
+   if (c && (c->x_hot <= c->width) && (c->y_hot <= c->height))

-:36: CHECK:UNNECESSARY_PARENTHESES: Unnecessary parentheses around 'c->y_hot 
<= c->height'
#36: FILE: drivers/gpu/drm/i915/gvt/dmabuf.c:197:
+   if (c && (c->x_hot <= c->width) && (c->y_hot <= c->height))

total: 0 errors, 0 warnings, 2 checks, 79 lines checked

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v4] drm/i915/gvt: Deliver guest cursor hotspot info

2018-04-15 Thread Zhang, Tina


> -Original Message-
> From: Zhenyu Wang [mailto:zhen...@linux.intel.com]
> Sent: Monday, April 16, 2018 1:52 PM
> To: Zhang, Tina 
> Cc: intel-gvt-...@lists.freedesktop.org; kra...@redhat.com; intel-
> g...@lists.freedesktop.org; Wang, Zhi A 
> Subject: Re: [PATCH v4] drm/i915/gvt: Deliver guest cursor hotspot info
> 
> On 2018.04.16 13:51:38 +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.
> >
> > v3->v4:
> > - return UINT_MAX when x_hot/y_hot is invalid. (Zhenyu)
> > - correct version.
> >
> > v2->v3:
> > - add validate_hotspot(). (Zhenyu)
> >
> > v1->v2:
> > - name as cursor_x_hot/cursor_y_hot. (Zhenyu)
> > - use i915_reg_t definition instead of magic numbers. (Zhenyu)
> >
> > Signed-off-by: Tina Zhang 
> > Cc: Zhenyu Wang 
> > Cc: Zhi Wang 
> > Cc: Gerd Hoffmann 
> > ---
> >  drivers/gpu/drm/i915/gvt/dmabuf.c | 22 --
> >  drivers/gpu/drm/i915/gvt/fb_decoder.c |  3 +++
> >  drivers/gpu/drm/i915/gvt/handlers.c   |  4 ++--
> >  drivers/gpu/drm/i915/gvt/vgpu.c   |  3 +++
> >  drivers/gpu/drm/i915/i915_pvinfo.h|  5 -
> >  5 files changed, 28 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c
> > b/drivers/gpu/drm/i915/gvt/dmabuf.c
> > index 6f4f8e9..a7c7082 100644
> > --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> > +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> > @@ -192,6 +192,14 @@ static struct drm_i915_gem_object
> *vgpu_create_gem(struct drm_device *dev,
> > return obj;
> >  }
> >
> > +static bool validate_hotspot(struct intel_vgpu_cursor_plane_format
> > +*c) {
> > +   if (c && (c->x_hot <= c->width) && (c->y_hot <= c->height))
> > +   return true;
> 
> No way c could be NULL here.
See, we check c first.

BR,
Tina
> 
> > +   else
> > +   return false;
> > +}
> > +
> >  static int vgpu_get_plane_info(struct drm_device *dev,
> > struct intel_vgpu *vgpu,
> > struct intel_vgpu_fb_info *info,
> > @@ -229,12 +237,14 @@ 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;
> > +   if (validate_hotspot(&c)) {
> > +   info->x_hot = c.x_hot;
> > +   info->y_hot = c.y_hot;
> > +   } else {
> > +   info->x_hot = UINT_MAX;
> > +   info->y_hot = UINT_MAX;
> > +   }
> > +
> > 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 1c12068..5e7468b 100644
> > --- a/drivers/gpu/drm/i915/gvt/fb_decoder.c
> > +++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c
> > @@ -36,6 +36,7 @@
> >  #include 
> >  #include "i915_drv.h"
> >  #include "gvt.h"
> > +#include "i915_pvinfo.h"
> >
> >  #define PRIMARY_FORMAT_NUM 16
> >  struct pixel_format {
> > @@ -384,6 +385,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_t(vgpu, vgtif_reg(cursor_x_hot));
> > +   plane->y_hot = vgpu_vreg_t(vgpu, vgtif_reg(cursor_y_hot));
> > return 0;
> >  }
> >
> > diff --git a/drivers/gpu/drm/i915/gvt/handlers.c
> > b/drivers/gpu/drm/i915/gvt/handlers.c
> > index a33c1c3e..2c824a9 100644
> > --- a/drivers/gpu/drm/i915/gvt/handlers.c
> > +++ b/drivers/gpu/drm/i915/gvt/handlers.c
> > @@ -1201,8 +1201,8 @@ static int pvinfo_mmio_write(struct intel_vgpu
> *vgpu, unsigned int offset,
> > ret = handle_g2v_notification(vgpu, data);
> > break;
> > /* add xhot and yhot to handled list to avoid error log */
> > -   case 0x78830:
> > -   case 0x78834:
> > +   case _vgtif_reg(cursor_x_hot):
> > +   case _vgtif_reg(cursor_y_hot):
> > case _vgtif_reg(pdp[0].lo):
> > case _vgtif_reg(pdp[0].hi):
> > case _vgtif_reg(pdp[1].lo):
> > diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c
> > b/drivers/gpu/drm/i915/gvt/vgpu.c index 2e0a02a..bf75300 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_t(vgpu, vgtif_reg(cursor_x_hot)) = UINT_MAX;
> > +   vgpu_vreg_t(vgpu, vgtif_reg(cursor_y_hot)) = UINT_MAX