[PATCH 1/2] drm/i915/gvt: Roundup fb->height into tile's height at calucation fb->size
Zhenyu Wang
zhenyuw at linux.intel.com
Thu Apr 11 02:58:01 UTC 2019
On 2019.04.10 12:16:33 +0800, Xiong Zhang wrote:
> When fb is tiled and fb->height isn't the multiple of tile's height,
> the format fb->size = fb->stride * fb->height, will get a smaller size
> than the actual size. As the memory height of tiled fb should be multiple
> of tile's height.
>
> Fixes: 7f1a93b1f1d1("drm/i915/gvt: Correct the calculation of plane size")
>
> Signed-off-by: Xiong Zhang <xiong.y.zhang at intel.com>
> ---
Reviewed-by: Zhenyu Wang <zhenyuw at linux.intel.com>
Thanks for the fix!
> drivers/gpu/drm/i915/gvt/dmabuf.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
> index f6be971..4e1e425 100644
> --- a/drivers/gpu/drm/i915/gvt/dmabuf.c
> +++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
> @@ -209,7 +209,7 @@ static int vgpu_get_plane_info(struct drm_device *dev,
> struct drm_i915_private *dev_priv = to_i915(dev);
> struct intel_vgpu_primary_plane_format p;
> struct intel_vgpu_cursor_plane_format c;
> - int ret;
> + int ret, tile_height = 1;
>
> if (plane_id == DRM_PLANE_TYPE_PRIMARY) {
> ret = intel_vgpu_decode_primary_plane(vgpu, &p);
> @@ -228,12 +228,15 @@ static int vgpu_get_plane_info(struct drm_device *dev,
> break;
> case PLANE_CTL_TILED_X:
> info->drm_format_mod = I915_FORMAT_MOD_X_TILED;
> + tile_height = 8;
> break;
> case PLANE_CTL_TILED_Y:
> info->drm_format_mod = I915_FORMAT_MOD_Y_TILED;
> + tile_height = 32;
> break;
> case PLANE_CTL_TILED_YF:
> info->drm_format_mod = I915_FORMAT_MOD_Yf_TILED;
> + tile_height = 32;
> break;
> default:
> gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled);
> @@ -264,8 +267,8 @@ static int vgpu_get_plane_info(struct drm_device *dev,
> return -EINVAL;
> }
>
> - info->size = (info->stride * info->height + PAGE_SIZE - 1)
> - >> PAGE_SHIFT;
> + info->size = (info->stride * roundup(info->height, tile_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/20190411/a186583e/attachment.sig>
More information about the intel-gvt-dev
mailing list