[PATCH 1/2] drm/i915/gvt: Correct the calculation of plane size

Zhenyu Wang zhenyuw at linux.intel.com
Thu Mar 21 07:53:57 UTC 2019


On 2019.03.19 10:28:44 +0800, Xiong Zhang wrote:
> stride isn't in unit of pixel, it is bytes, so calculation of
> plane size doesn't need to multiple bpp.
>

Fixes tag?

> Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/dmabuf.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index 3e7e2b8..5d887f7 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -238,9 +238,6 @@ static int vgpu_get_plane_info(struct drm_device *dev,
>  		default:
>  			gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled);
>  		}
> -
> -		info->size = (((p.stride * p.height * p.bpp) / 8) +
> -			      (PAGE_SIZE - 1)) >> PAGE_SHIFT;
>  	} else if (plane_id == DRM_PLANE_TYPE_CURSOR) {
>  		ret = intel_vgpu_decode_cursor_plane(vgpu, &c);
>  		if (ret)
> @@ -262,14 +259,13 @@ static int vgpu_get_plane_info(struct drm_device *dev,
>  			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 {
>  		gvt_vgpu_err("invalid plane id:%d\n", plane_id);
>  		return -EINVAL;
>  	}
>  
> +	info->size = (info->stride * info->height + PAGE_SIZE - 1)
> +		      >> PAGE_SHIFT;
>  	if (info->size == 0) {
>  		gvt_vgpu_err("fb size is zero\n");
>  		return -EINVAL;
> -- 
> 2.7.4
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

-- 
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/20190321/8d91d495/attachment.sig>


More information about the intel-gvt-dev mailing list