aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2018-08-29 22:50:36 -0400
committerZhenyu Wang <zhenyuw@linux.intel.com>2018-08-30 00:56:33 -0400
commitb244ffa15c8b1aabdc117c0b6008086df7b668b7 (patch)
tree973d945998d4ebe9195c839ac266902708c1297e /drivers/gpu
parentb2b599fb54f90ae395ddc51f0d49e4f28244a8f8 (diff)
drm/i915/gvt: Fix drm_format_mod value for vGPU plane
Physical plane's tiling mode value is given directly as drm_format_mod for plane query, which is not correct fourcc code. Fix it by using correct intel tiling fourcc mod definition. Current qemu seems also doesn't correctly utilize drm_format_mod for plane object setting. Anyway this is required to fix the usage. v3: use DRM_FORMAT_MOD_LINEAR, fix comment v2: Fix missed old 'tiled' use for stride calculation Fixes: e546e281d33d ("drm/i915/gvt: Dmabuf support for GVT-g") Cc: Tina Zhang <tina.zhang@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Colin Xu <Colin.Xu@intel.com> Reviewed-by: Colin Xu <Colin.Xu@intel.com> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/i915/gvt/dmabuf.c33
-rw-r--r--drivers/gpu/drm/i915/gvt/fb_decoder.c5
-rw-r--r--drivers/gpu/drm/i915/gvt/fb_decoder.h2
3 files changed, 29 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/gvt/dmabuf.c b/drivers/gpu/drm/i915/gvt/dmabuf.c
index 6e3f56684f4e..51ed99a37803 100644
--- a/drivers/gpu/drm/i915/gvt/dmabuf.c
+++ b/drivers/gpu/drm/i915/gvt/dmabuf.c
@@ -170,20 +170,22 @@ static struct drm_i915_gem_object *vgpu_create_gem(struct drm_device *dev,
170 unsigned int tiling_mode = 0; 170 unsigned int tiling_mode = 0;
171 unsigned int stride = 0; 171 unsigned int stride = 0;
172 172
173 switch (info->drm_format_mod << 10) { 173 switch (info->drm_format_mod) {
174 case PLANE_CTL_TILED_LINEAR: 174 case DRM_FORMAT_MOD_LINEAR:
175 tiling_mode = I915_TILING_NONE; 175 tiling_mode = I915_TILING_NONE;
176 break; 176 break;
177 case PLANE_CTL_TILED_X: 177 case I915_FORMAT_MOD_X_TILED:
178 tiling_mode = I915_TILING_X; 178 tiling_mode = I915_TILING_X;
179 stride = info->stride; 179 stride = info->stride;
180 break; 180 break;
181 case PLANE_CTL_TILED_Y: 181 case I915_FORMAT_MOD_Y_TILED:
182 case I915_FORMAT_MOD_Yf_TILED:
182 tiling_mode = I915_TILING_Y; 183 tiling_mode = I915_TILING_Y;
183 stride = info->stride; 184 stride = info->stride;
184 break; 185 break;
185 default: 186 default:
186 gvt_dbg_core("not supported tiling mode\n"); 187 gvt_dbg_core("invalid drm_format_mod %llx for tiling\n",
188 info->drm_format_mod);
187 } 189 }
188 obj->tiling_and_stride = tiling_mode | stride; 190 obj->tiling_and_stride = tiling_mode | stride;
189 } else { 191 } else {
@@ -222,9 +224,26 @@ static int vgpu_get_plane_info(struct drm_device *dev,
222 info->height = p.height; 224 info->height = p.height;
223 info->stride = p.stride; 225 info->stride = p.stride;
224 info->drm_format = p.drm_format; 226 info->drm_format = p.drm_format;
225 info->drm_format_mod = p.tiled; 227
228 switch (p.tiled) {
229 case PLANE_CTL_TILED_LINEAR:
230 info->drm_format_mod = DRM_FORMAT_MOD_LINEAR;
231 break;
232 case PLANE_CTL_TILED_X:
233 info->drm_format_mod = I915_FORMAT_MOD_X_TILED;
234 break;
235 case PLANE_CTL_TILED_Y:
236 info->drm_format_mod = I915_FORMAT_MOD_Y_TILED;
237 break;
238 case PLANE_CTL_TILED_YF:
239 info->drm_format_mod = I915_FORMAT_MOD_Yf_TILED;
240 break;
241 default:
242 gvt_vgpu_err("invalid tiling mode: %x\n", p.tiled);
243 }
244
226 info->size = (((p.stride * p.height * p.bpp) / 8) + 245 info->size = (((p.stride * p.height * p.bpp) / 8) +
227 (PAGE_SIZE - 1)) >> PAGE_SHIFT; 246 (PAGE_SIZE - 1)) >> PAGE_SHIFT;
228 } else if (plane_id == DRM_PLANE_TYPE_CURSOR) { 247 } else if (plane_id == DRM_PLANE_TYPE_CURSOR) {
229 ret = intel_vgpu_decode_cursor_plane(vgpu, &c); 248 ret = intel_vgpu_decode_cursor_plane(vgpu, &c);
230 if (ret) 249 if (ret)
diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.c b/drivers/gpu/drm/i915/gvt/fb_decoder.c
index face664be3e8..481896fb712a 100644
--- a/drivers/gpu/drm/i915/gvt/fb_decoder.c
+++ b/drivers/gpu/drm/i915/gvt/fb_decoder.c
@@ -220,8 +220,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu,
220 if (IS_SKYLAKE(dev_priv) 220 if (IS_SKYLAKE(dev_priv)
221 || IS_KABYLAKE(dev_priv) 221 || IS_KABYLAKE(dev_priv)
222 || IS_BROXTON(dev_priv)) { 222 || IS_BROXTON(dev_priv)) {
223 plane->tiled = (val & PLANE_CTL_TILED_MASK) >> 223 plane->tiled = val & PLANE_CTL_TILED_MASK;
224 _PLANE_CTL_TILED_SHIFT;
225 fmt = skl_format_to_drm( 224 fmt = skl_format_to_drm(
226 val & PLANE_CTL_FORMAT_MASK, 225 val & PLANE_CTL_FORMAT_MASK,
227 val & PLANE_CTL_ORDER_RGBX, 226 val & PLANE_CTL_ORDER_RGBX,
@@ -260,7 +259,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu,
260 return -EINVAL; 259 return -EINVAL;
261 } 260 }
262 261
263 plane->stride = intel_vgpu_get_stride(vgpu, pipe, (plane->tiled << 10), 262 plane->stride = intel_vgpu_get_stride(vgpu, pipe, plane->tiled,
264 (IS_SKYLAKE(dev_priv) 263 (IS_SKYLAKE(dev_priv)
265 || IS_KABYLAKE(dev_priv) 264 || IS_KABYLAKE(dev_priv)
266 || IS_BROXTON(dev_priv)) ? 265 || IS_BROXTON(dev_priv)) ?
diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.h b/drivers/gpu/drm/i915/gvt/fb_decoder.h
index cb055f3c81a2..60c155085029 100644
--- a/drivers/gpu/drm/i915/gvt/fb_decoder.h
+++ b/drivers/gpu/drm/i915/gvt/fb_decoder.h
@@ -101,7 +101,7 @@ struct intel_gvt;
101/* color space conversion and gamma correction are not included */ 101/* color space conversion and gamma correction are not included */
102struct intel_vgpu_primary_plane_format { 102struct intel_vgpu_primary_plane_format {
103 u8 enabled; /* plane is enabled */ 103 u8 enabled; /* plane is enabled */
104 u8 tiled; /* X-tiled */ 104 u32 tiled; /* tiling mode: linear, X-tiled, Y tiled, etc */
105 u8 bpp; /* bits per pixel */ 105 u8 bpp; /* bits per pixel */
106 u32 hw_format; /* format field in the PRI_CTL register */ 106 u32 hw_format; /* format field in the PRI_CTL register */
107 u32 drm_format; /* format in DRM definition */ 107 u32 drm_format; /* format in DRM definition */