clear-pkgs-linux-iot-lts2018/0624-drm-i915-gvt-handling-...

106 lines
3.7 KiB
Diff

From b27cf4bdf6fd4e65e4e9e51a8c5cb6ede2a25b40 Mon Sep 17 00:00:00 2001
From: Fei Jiang <fei.jiang@intel.com>
Date: Fri, 14 Sep 2018 16:10:20 +0800
Subject: [PATCH 624/743] drm/i915/gvt: handling pvmmio update of plane
registers in GVT-g
When pvmmio level PVMMIO_PLANE_UPDATE is enabled, need handle multiple
plane related registers updating together when PLANE_SURF is traped.
sos only patch.
V2: restore sequence of skl_plane_mmio_write/skl_plane_mmio_write and
skl_plane_surf_write, while need add extra declarations.
Signed-off-by: Fei Jiang <fei.jiang@intel.com>
Reviewed-by: Min He <min.he@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
---
drivers/gpu/drm/i915/gvt/handlers.c | 64 +++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/drivers/gpu/drm/i915/gvt/handlers.c b/drivers/gpu/drm/i915/gvt/handlers.c
index 14a75c6dff4d..afa15c0bb347 100644
--- a/drivers/gpu/drm/i915/gvt/handlers.c
+++ b/drivers/gpu/drm/i915/gvt/handlers.c
@@ -778,6 +778,66 @@ static int spr_surf_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
return 0;
}
+static int skl_plane_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
+ void *p_data, unsigned int bytes);
+static int skl_ps_mmio_write(struct intel_vgpu *vgpu, unsigned int offset,
+ void *p_data, unsigned int bytes);
+
+static void pvmmio_update_plane_register(struct intel_vgpu *vgpu,
+ unsigned int pipe, unsigned int plane)
+{
+ struct pv_plane_update *pv_plane = &vgpu->mmio.shared_page->pv_plane;
+
+ /* null function for PLANE_COLOR_CTL, PLANE_AUX_DIST, PLANE_AUX_OFFSET,
+ * and SKL_PS_PWR_GATE register trap
+ */
+
+ if (pv_plane->flags & PLANE_KEY_BIT) {
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_KEYVAL(pipe, plane)),
+ &pv_plane->plane_key_val, 4);
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_KEYMAX(pipe, plane)),
+ &pv_plane->plane_key_max, 4);
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_KEYMSK(pipe, plane)),
+ &pv_plane->plane_key_msk, 4);
+ }
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_OFFSET(pipe, plane)),
+ &pv_plane->plane_offset, 4);
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_STRIDE(pipe, plane)),
+ &pv_plane->plane_stride, 4);
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_SIZE(pipe, plane)),
+ &pv_plane->plane_size, 4);
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_AUX_DIST(pipe, plane)),
+ &pv_plane->plane_aux_dist, 4);
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_AUX_OFFSET(pipe, plane)),
+ &pv_plane->plane_aux_offset, 4);
+
+ if (pv_plane->flags & PLANE_SCALER_BIT) {
+ skl_ps_mmio_write(vgpu,
+ i915_mmio_reg_offset(SKL_PS_CTRL(pipe, plane)),
+ &pv_plane->ps_ctrl, 4);
+ skl_ps_mmio_write(vgpu,
+ i915_mmio_reg_offset(SKL_PS_WIN_POS(pipe, plane)),
+ &pv_plane->ps_win_ps, 4);
+ skl_ps_mmio_write(vgpu,
+ i915_mmio_reg_offset(SKL_PS_WIN_SZ(pipe, plane)),
+ &pv_plane->ps_win_sz, 4);
+ }
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_POS(pipe, plane)),
+ &pv_plane->plane_pos, 4);
+ skl_plane_mmio_write(vgpu,
+ i915_mmio_reg_offset(PLANE_CTL(pipe, plane)),
+ &pv_plane->plane_ctl, 4);
+}
+
static int trigger_aux_channel_interrupt(struct intel_vgpu *vgpu,
unsigned int reg)
{
@@ -2850,6 +2910,10 @@ static int skl_plane_surf_write(struct intel_vgpu *vgpu, unsigned int offset,
i915_reg_t reg_1ac = _MMIO(_REG_701AC(pipe, plane));
int flip_event = SKL_FLIP_EVENT(pipe, plane);
+ /* plane disable is not pv and it is indicated by value 0 */
+ if (*(u32 *)p_data != 0 && VGPU_PVMMIO(vgpu) & PVMMIO_PLANE_UPDATE)
+ pvmmio_update_plane_register(vgpu, pipe, plane);
+
write_vreg(vgpu, offset, p_data, bytes);
vgpu_vreg_t(vgpu, reg_1ac) = vgpu_vreg(vgpu, offset);
--
2.19.2