diff options
| author | Xiong Zhang <xiong.y.zhang@intel.com> | 2019-03-25 04:29:19 -0400 |
|---|---|---|
| committer | Zhenyu Wang <zhenyuw@linux.intel.com> | 2019-04-03 20:44:37 -0400 |
| commit | 7f1a93b1f1d1d2603a49a9e4226259db9272f305 (patch) | |
| tree | 834f64cd9b880f7e19044cf6f7508c92cb081fac | |
| parent | 663a50ceac75c2208d2ad95365bc8382fd42f44d (diff) | |
drm/i915/gvt: Correct the calculation of plane size
stride isn't in unit of pixel, it is bytes, so calculation of
plane size doesn't need to multiple bpp.
Fixes: e546e281d33d ("drm/i915/gvt: Dmabuf support for GVT-g")
Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
| -rw-r--r-- | drivers/gpu/drm/i915/gvt/dmabuf.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c index 3e7e2b80c857..5d887f7cc0d5 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, | |||
| 238 | default: | 238 | default: |
| 239 | gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled); | 239 | gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled); |
| 240 | } | 240 | } |
| 241 | |||
| 242 | info->size = (((p.stride * p.height * p.bpp) / 8) + | ||
| 243 | (PAGE_SIZE - 1)) >> PAGE_SHIFT; | ||
| 244 | } else if (plane_id == DRM_PLANE_TYPE_CURSOR) { | 241 | } else if (plane_id == DRM_PLANE_TYPE_CURSOR) { |
| 245 | ret = intel_vgpu_decode_cursor_plane(vgpu, &c); | 242 | ret = intel_vgpu_decode_cursor_plane(vgpu, &c); |
| 246 | if (ret) | 243 | if (ret) |
| @@ -262,14 +259,13 @@ static int vgpu_get_plane_info(struct drm_device *dev, | |||
| 262 | info->x_hot = UINT_MAX; | 259 | info->x_hot = UINT_MAX; |
| 263 | info->y_hot = UINT_MAX; | 260 | info->y_hot = UINT_MAX; |
| 264 | } | 261 | } |
| 265 | |||
| 266 | info->size = (((info->stride * c.height * c.bpp) / 8) | ||
| 267 | + (PAGE_SIZE - 1)) >> PAGE_SHIFT; | ||
| 268 | } else { | 262 | } else { |
| 269 | gvt_vgpu_err("invalid plane id:%d\n", plane_id); | 263 | gvt_vgpu_err("invalid plane id:%d\n", plane_id); |
| 270 | return -EINVAL; | 264 | return -EINVAL; |
| 271 | } | 265 | } |
| 272 | 266 | ||
| 267 | info->size = (info->stride * info->height + PAGE_SIZE - 1) | ||
| 268 | >> PAGE_SHIFT; | ||
| 273 | if (info->size == 0) { | 269 | if (info->size == 0) { |
| 274 | gvt_vgpu_err("fb size is zero\n"); | 270 | gvt_vgpu_err("fb size is zero\n"); |
| 275 | return -EINVAL; | 271 | return -EINVAL; |
