Commit 12d7d858 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Use REG_BIT() & co. for universal plane bits

Polish the skl+ universal plane register defines by
using REG_BIT() & co.

The defines are also currently spread around in some
semi-random fashion. Collect them up into one place.

v2: deal with gvt
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211201152552.7821-7-ville.syrjala@linux.intel.comReviewed-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
parent 71b59439
...@@ -1048,11 +1048,12 @@ skl_program_plane_noarm(struct intel_plane *plane, ...@@ -1048,11 +1048,12 @@ skl_program_plane_noarm(struct intel_plane *plane,
if (plane_state->force_black) if (plane_state->force_black)
icl_plane_csc_load_black(plane); icl_plane_csc_load_black(plane);
intel_de_write_fw(dev_priv, PLANE_STRIDE(pipe, plane_id), stride); intel_de_write_fw(dev_priv, PLANE_STRIDE(pipe, plane_id),
PLANE_STRIDE_(stride));
intel_de_write_fw(dev_priv, PLANE_POS(pipe, plane_id), intel_de_write_fw(dev_priv, PLANE_POS(pipe, plane_id),
(crtc_y << 16) | crtc_x); PLANE_POS_Y(crtc_y) | PLANE_POS_X(crtc_x));
intel_de_write_fw(dev_priv, PLANE_SIZE(pipe, plane_id), intel_de_write_fw(dev_priv, PLANE_SIZE(pipe, plane_id),
((src_h - 1) << 16) | (src_w - 1)); PLANE_HEIGHT(src_h - 1) | PLANE_WIDTH(src_w - 1));
if (intel_fb_is_rc_ccs_cc_modifier(fb->modifier)) { if (intel_fb_is_rc_ccs_cc_modifier(fb->modifier)) {
intel_de_write_fw(dev_priv, PLANE_CC_VAL(pipe, plane_id, 0), intel_de_write_fw(dev_priv, PLANE_CC_VAL(pipe, plane_id, 0),
...@@ -1111,7 +1112,7 @@ skl_program_plane_arm(struct intel_plane *plane, ...@@ -1111,7 +1112,7 @@ skl_program_plane_arm(struct intel_plane *plane,
skl_surf_address(plane_state, color_plane); skl_surf_address(plane_state, color_plane);
if (DISPLAY_VER(dev_priv) < 12) if (DISPLAY_VER(dev_priv) < 12)
aux_dist |= skl_plane_stride(plane_state, aux_plane); aux_dist |= PLANE_AUX_STRIDE(skl_plane_stride(plane_state, aux_plane));
} }
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
...@@ -1122,14 +1123,14 @@ skl_program_plane_arm(struct intel_plane *plane, ...@@ -1122,14 +1123,14 @@ skl_program_plane_arm(struct intel_plane *plane,
intel_de_write_fw(dev_priv, PLANE_KEYMAX(pipe, plane_id), keymax); intel_de_write_fw(dev_priv, PLANE_KEYMAX(pipe, plane_id), keymax);
intel_de_write_fw(dev_priv, PLANE_OFFSET(pipe, plane_id), intel_de_write_fw(dev_priv, PLANE_OFFSET(pipe, plane_id),
(y << 16) | x); PLANE_OFFSET_Y(y) | PLANE_OFFSET_X(x));
intel_de_write_fw(dev_priv, PLANE_AUX_DIST(pipe, plane_id), aux_dist); intel_de_write_fw(dev_priv, PLANE_AUX_DIST(pipe, plane_id), aux_dist);
if (DISPLAY_VER(dev_priv) < 11) if (DISPLAY_VER(dev_priv) < 11)
intel_de_write_fw(dev_priv, PLANE_AUX_OFFSET(pipe, plane_id), intel_de_write_fw(dev_priv, PLANE_AUX_OFFSET(pipe, plane_id),
(plane_state->view.color_plane[1].y << 16) | PLANE_OFFSET_Y(plane_state->view.color_plane[1].y) |
plane_state->view.color_plane[1].x); PLANE_OFFSET_X(plane_state->view.color_plane[1].x));
if (DISPLAY_VER(dev_priv) >= 10) if (DISPLAY_VER(dev_priv) >= 10)
intel_de_write_fw(dev_priv, PLANE_COLOR_CTL(pipe, plane_id), plane_color_ctl); intel_de_write_fw(dev_priv, PLANE_COLOR_CTL(pipe, plane_id), plane_color_ctl);
...@@ -2289,16 +2290,17 @@ skl_get_initial_plane_config(struct intel_crtc *crtc, ...@@ -2289,16 +2290,17 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
val = intel_de_read(dev_priv, PLANE_CTL(pipe, plane_id)); val = intel_de_read(dev_priv, PLANE_CTL(pipe, plane_id));
if (DISPLAY_VER(dev_priv) >= 11) if (DISPLAY_VER(dev_priv) >= 11)
pixel_format = val & ICL_PLANE_CTL_FORMAT_MASK; pixel_format = val & PLANE_CTL_FORMAT_MASK_ICL;
else else
pixel_format = val & PLANE_CTL_FORMAT_MASK; pixel_format = val & PLANE_CTL_FORMAT_MASK_SKL;
if (DISPLAY_VER(dev_priv) >= 10) { if (DISPLAY_VER(dev_priv) >= 10) {
alpha = intel_de_read(dev_priv, u32 color_ctl;
PLANE_COLOR_CTL(pipe, plane_id));
alpha &= PLANE_COLOR_ALPHA_MASK; color_ctl = intel_de_read(dev_priv, PLANE_COLOR_CTL(pipe, plane_id));
alpha = REG_FIELD_GET(PLANE_COLOR_ALPHA_MASK, color_ctl);
} else { } else {
alpha = val & PLANE_CTL_ALPHA_MASK; alpha = REG_FIELD_GET(PLANE_CTL_ALPHA_MASK, val);
} }
fourcc = skl_format_to_fourcc(pixel_format, fourcc = skl_format_to_fourcc(pixel_format,
...@@ -2362,19 +2364,19 @@ skl_get_initial_plane_config(struct intel_crtc *crtc, ...@@ -2362,19 +2364,19 @@ skl_get_initial_plane_config(struct intel_crtc *crtc,
if (drm_rotation_90_or_270(plane_config->rotation)) if (drm_rotation_90_or_270(plane_config->rotation))
goto error; goto error;
base = intel_de_read(dev_priv, PLANE_SURF(pipe, plane_id)) & 0xfffff000; base = intel_de_read(dev_priv, PLANE_SURF(pipe, plane_id)) & PLANE_SURF_ADDR_MASK;
plane_config->base = base; plane_config->base = base;
offset = intel_de_read(dev_priv, PLANE_OFFSET(pipe, plane_id)); offset = intel_de_read(dev_priv, PLANE_OFFSET(pipe, plane_id));
val = intel_de_read(dev_priv, PLANE_SIZE(pipe, plane_id)); val = intel_de_read(dev_priv, PLANE_SIZE(pipe, plane_id));
fb->height = ((val >> 16) & 0xffff) + 1; fb->height = REG_FIELD_GET(PLANE_HEIGHT_MASK, val) + 1;
fb->width = ((val >> 0) & 0xffff) + 1; fb->width = REG_FIELD_GET(PLANE_WIDTH_MASK, val) + 1;
val = intel_de_read(dev_priv, PLANE_STRIDE(pipe, plane_id)); val = intel_de_read(dev_priv, PLANE_STRIDE(pipe, plane_id));
stride_mult = skl_plane_stride_mult(fb, 0, DRM_MODE_ROTATE_0); stride_mult = skl_plane_stride_mult(fb, 0, DRM_MODE_ROTATE_0);
fb->pitches[0] = (val & PLANE_STRIDE_MASK) * stride_mult; fb->pitches[0] = REG_FIELD_GET(PLANE_STRIDE__MASK, val) * stride_mult;
aligned_height = intel_fb_align_height(fb, 0, fb->height); aligned_height = intel_fb_align_height(fb, 0, fb->height);
......
...@@ -218,7 +218,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, ...@@ -218,7 +218,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu,
if (GRAPHICS_VER(dev_priv) >= 9) { if (GRAPHICS_VER(dev_priv) >= 9) {
plane->tiled = val & PLANE_CTL_TILED_MASK; plane->tiled = val & PLANE_CTL_TILED_MASK;
fmt = skl_format_to_drm( fmt = skl_format_to_drm(
val & PLANE_CTL_FORMAT_MASK, val & PLANE_CTL_FORMAT_MASK_SKL,
val & PLANE_CTL_ORDER_RGBX, val & PLANE_CTL_ORDER_RGBX,
val & PLANE_CTL_ALPHA_MASK, val & PLANE_CTL_ALPHA_MASK,
val & PLANE_CTL_YUV422_ORDER_MASK); val & PLANE_CTL_YUV422_ORDER_MASK);
......
...@@ -62,7 +62,6 @@ ...@@ -62,7 +62,6 @@
#define SKL_FLIP_EVENT(pipe, plane) (PRIMARY_A_FLIP_DONE + (plane) * 3 + (pipe)) #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_MASK 0x3
#define REG50080_FLIP_TYPE_ASYNC 0x1 #define REG50080_FLIP_TYPE_ASYNC 0x1
......
This diff is collapsed.
...@@ -4292,11 +4292,10 @@ skl_cursor_allocation(const struct intel_crtc_state *crtc_state, ...@@ -4292,11 +4292,10 @@ skl_cursor_allocation(const struct intel_crtc_state *crtc_state,
static void skl_ddb_entry_init_from_hw(struct drm_i915_private *dev_priv, static void skl_ddb_entry_init_from_hw(struct drm_i915_private *dev_priv,
struct skl_ddb_entry *entry, u32 reg) struct skl_ddb_entry *entry, u32 reg)
{ {
entry->start = reg & DDB_ENTRY_MASK; entry->start = REG_FIELD_GET(PLANE_BUF_START_MASK, reg);
entry->end = (reg >> DDB_ENTRY_END_SHIFT) & DDB_ENTRY_MASK; entry->end = REG_FIELD_GET(PLANE_BUF_END_MASK, reg);
if (entry->end) if (entry->end)
entry->end += 1; entry->end++;
} }
static void static void
...@@ -4320,7 +4319,7 @@ skl_ddb_get_hw_plane_state(struct drm_i915_private *dev_priv, ...@@ -4320,7 +4319,7 @@ skl_ddb_get_hw_plane_state(struct drm_i915_private *dev_priv,
/* No DDB allocated for disabled planes */ /* No DDB allocated for disabled planes */
if (val & PLANE_CTL_ENABLE) if (val & PLANE_CTL_ENABLE)
fourcc = skl_format_to_fourcc(val & PLANE_CTL_FORMAT_MASK, fourcc = skl_format_to_fourcc(val & PLANE_CTL_FORMAT_MASK_SKL,
val & PLANE_CTL_ORDER_RGBX, val & PLANE_CTL_ORDER_RGBX,
val & PLANE_CTL_ALPHA_MASK); val & PLANE_CTL_ALPHA_MASK);
...@@ -5891,7 +5890,8 @@ static void skl_ddb_entry_write(struct drm_i915_private *dev_priv, ...@@ -5891,7 +5890,8 @@ static void skl_ddb_entry_write(struct drm_i915_private *dev_priv,
{ {
if (entry->end) if (entry->end)
intel_de_write_fw(dev_priv, reg, intel_de_write_fw(dev_priv, reg,
(entry->end - 1) << 16 | entry->start); PLANE_BUF_END(entry->end - 1) |
PLANE_BUF_START(entry->start));
else else
intel_de_write_fw(dev_priv, reg, 0); intel_de_write_fw(dev_priv, reg, 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment