OSDN Git Service

drm/i915/gvt: Add macro define for mmio 0x50080 and gvt flip event
authorColin Xu <colin.xu@intel.com>
Mon, 25 Mar 2019 01:52:15 +0000 (09:52 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Fri, 29 Mar 2019 03:09:34 +0000 (11:09 +0800)
Add SKL_FLIP_EVENT to address into intel_gvt_event_type for primary
and sprite0 plane flip event.
Add macro to address REG_50080 offset.

v2:
Add bit operation definition for flip mode. (zhenyu)

Reviewed-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Colin Xu <colin.xu@intel.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
drivers/gpu/drm/i915/gvt/reg.h

index 56cff20..3de5b64 100644 (file)
 #define _REG_701C0(pipe, plane) (0x701c0 + pipe * 0x1000 + (plane - 1) * 0x100)
 #define _REG_701C4(pipe, plane) (0x701c4 + pipe * 0x1000 + (plane - 1) * 0x100)
 
+#define SKL_FLIP_EVENT(pipe, plane) (PRIMARY_A_FLIP_DONE + (plane) * 3 + (pipe))
+
+#define PLANE_CTL_ASYNC_FLIP           (1 << 9)
+#define REG50080_FLIP_TYPE_MASK        0x3
+#define REG50080_FLIP_TYPE_ASYNC       0x1
+
+#define REG_50080(_pipe, _plane) ({ \
+       typeof(_pipe) (p) = (_pipe); \
+       typeof(_plane) (q) = (_plane); \
+       (((p) == PIPE_A) ? (((q) == PLANE_PRIMARY) ? (_MMIO(0x50080)) : \
+               (_MMIO(0x50090))) : \
+       (((p) == PIPE_B) ? (((q) == PLANE_PRIMARY) ? (_MMIO(0x50088)) : \
+               (_MMIO(0x50098))) : \
+       (((p) == PIPE_C) ? (((q) == PLANE_PRIMARY) ? (_MMIO(0x5008C)) : \
+               (_MMIO(0x5009C))) : \
+               (_MMIO(0x50080))))); })
+
+#define REG_50080_TO_PIPE(_reg) ({ \
+       typeof(_reg) (reg) = (_reg); \
+       (((reg) == 0x50080 || (reg) == 0x50090) ? (PIPE_A) : \
+       (((reg) == 0x50088 || (reg) == 0x50098) ? (PIPE_B) : \
+       (((reg) == 0x5008C || (reg) == 0x5009C) ? (PIPE_C) : \
+       (INVALID_PIPE)))); })
+
+#define REG_50080_TO_PLANE(_reg) ({ \
+       typeof(_reg) (reg) = (_reg); \
+       (((reg) == 0x50080 || (reg) == 0x50088 || (reg) == 0x5008C) ? \
+               (PLANE_PRIMARY) : \
+       (((reg) == 0x50090 || (reg) == 0x50098 || (reg) == 0x5009C) ? \
+               (PLANE_SPRITE0) : (I915_MAX_PLANES))); })
+
 #define GFX_MODE_BIT_SET_IN_MASK(val, bit) \
                ((((bit) & 0xffff0000) == 0) && !!((val) & (((bit) << 16))))