Commit 428cb15d authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Clean up pre-skl primary plane registers

Use REG_BIT() & co. for the pre-skl primary plane registers.
Also give everything a consistent namespace.

v2: s/DSP/DISP/ to avoid confusion (José)
    Use DISP_WIDTH rather than DISP_POS_X for DSPSIZE (José)
    Deal with gvt

Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220121113036.23240-2-ville.syrjala@linux.intel.comReviewed-by: default avatarJosé Roberto de Souza <jose.souza@intel.com>
parent 784a2ec0
...@@ -155,51 +155,51 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state, ...@@ -155,51 +155,51 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
unsigned int rotation = plane_state->hw.rotation; unsigned int rotation = plane_state->hw.rotation;
u32 dspcntr; u32 dspcntr;
dspcntr = DISPLAY_PLANE_ENABLE; dspcntr = DISP_ENABLE;
if (IS_G4X(dev_priv) || IS_IRONLAKE(dev_priv) || if (IS_G4X(dev_priv) || IS_IRONLAKE(dev_priv) ||
IS_SANDYBRIDGE(dev_priv) || IS_IVYBRIDGE(dev_priv)) IS_SANDYBRIDGE(dev_priv) || IS_IVYBRIDGE(dev_priv))
dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; dspcntr |= DISP_TRICKLE_FEED_DISABLE;
switch (fb->format->format) { switch (fb->format->format) {
case DRM_FORMAT_C8: case DRM_FORMAT_C8:
dspcntr |= DISPPLANE_8BPP; dspcntr |= DISP_FORMAT_8BPP;
break; break;
case DRM_FORMAT_XRGB1555: case DRM_FORMAT_XRGB1555:
dspcntr |= DISPPLANE_BGRX555; dspcntr |= DISP_FORMAT_BGRX555;
break; break;
case DRM_FORMAT_ARGB1555: case DRM_FORMAT_ARGB1555:
dspcntr |= DISPPLANE_BGRA555; dspcntr |= DISP_FORMAT_BGRA555;
break; break;
case DRM_FORMAT_RGB565: case DRM_FORMAT_RGB565:
dspcntr |= DISPPLANE_BGRX565; dspcntr |= DISP_FORMAT_BGRX565;
break; break;
case DRM_FORMAT_XRGB8888: case DRM_FORMAT_XRGB8888:
dspcntr |= DISPPLANE_BGRX888; dspcntr |= DISP_FORMAT_BGRX888;
break; break;
case DRM_FORMAT_XBGR8888: case DRM_FORMAT_XBGR8888:
dspcntr |= DISPPLANE_RGBX888; dspcntr |= DISP_FORMAT_RGBX888;
break; break;
case DRM_FORMAT_ARGB8888: case DRM_FORMAT_ARGB8888:
dspcntr |= DISPPLANE_BGRA888; dspcntr |= DISP_FORMAT_BGRA888;
break; break;
case DRM_FORMAT_ABGR8888: case DRM_FORMAT_ABGR8888:
dspcntr |= DISPPLANE_RGBA888; dspcntr |= DISP_FORMAT_RGBA888;
break; break;
case DRM_FORMAT_XRGB2101010: case DRM_FORMAT_XRGB2101010:
dspcntr |= DISPPLANE_BGRX101010; dspcntr |= DISP_FORMAT_BGRX101010;
break; break;
case DRM_FORMAT_XBGR2101010: case DRM_FORMAT_XBGR2101010:
dspcntr |= DISPPLANE_RGBX101010; dspcntr |= DISP_FORMAT_RGBX101010;
break; break;
case DRM_FORMAT_ARGB2101010: case DRM_FORMAT_ARGB2101010:
dspcntr |= DISPPLANE_BGRA101010; dspcntr |= DISP_FORMAT_BGRA101010;
break; break;
case DRM_FORMAT_ABGR2101010: case DRM_FORMAT_ABGR2101010:
dspcntr |= DISPPLANE_RGBA101010; dspcntr |= DISP_FORMAT_RGBA101010;
break; break;
case DRM_FORMAT_XBGR16161616F: case DRM_FORMAT_XBGR16161616F:
dspcntr |= DISPPLANE_RGBX161616; dspcntr |= DISP_FORMAT_RGBX161616;
break; break;
default: default:
MISSING_CASE(fb->format->format); MISSING_CASE(fb->format->format);
...@@ -208,13 +208,13 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state, ...@@ -208,13 +208,13 @@ static u32 i9xx_plane_ctl(const struct intel_crtc_state *crtc_state,
if (DISPLAY_VER(dev_priv) >= 4 && if (DISPLAY_VER(dev_priv) >= 4 &&
fb->modifier == I915_FORMAT_MOD_X_TILED) fb->modifier == I915_FORMAT_MOD_X_TILED)
dspcntr |= DISPPLANE_TILED; dspcntr |= DISP_TILED;
if (rotation & DRM_MODE_ROTATE_180) if (rotation & DRM_MODE_ROTATE_180)
dspcntr |= DISPPLANE_ROTATE_180; dspcntr |= DISP_ROTATE_180;
if (rotation & DRM_MODE_REFLECT_X) if (rotation & DRM_MODE_REFLECT_X)
dspcntr |= DISPPLANE_MIRROR; dspcntr |= DISP_MIRROR;
return dspcntr; return dspcntr;
} }
...@@ -354,13 +354,13 @@ static u32 i9xx_plane_ctl_crtc(const struct intel_crtc_state *crtc_state) ...@@ -354,13 +354,13 @@ static u32 i9xx_plane_ctl_crtc(const struct intel_crtc_state *crtc_state)
u32 dspcntr = 0; u32 dspcntr = 0;
if (crtc_state->gamma_enable) if (crtc_state->gamma_enable)
dspcntr |= DISPPLANE_GAMMA_ENABLE; dspcntr |= DISP_PIPE_GAMMA_ENABLE;
if (crtc_state->csc_enable) if (crtc_state->csc_enable)
dspcntr |= DISPPLANE_PIPE_CSC_ENABLE; dspcntr |= DISP_PIPE_CSC_ENABLE;
if (DISPLAY_VER(dev_priv) < 5) if (DISPLAY_VER(dev_priv) < 5)
dspcntr |= DISPPLANE_SEL_PIPE(crtc->pipe); dspcntr |= DISP_PIPE_SEL(crtc->pipe);
return dspcntr; return dspcntr;
} }
...@@ -437,9 +437,9 @@ static void i9xx_plane_update_noarm(struct intel_plane *plane, ...@@ -437,9 +437,9 @@ static void i9xx_plane_update_noarm(struct intel_plane *plane,
* program whatever is there. * program whatever is there.
*/ */
intel_de_write_fw(dev_priv, DSPPOS(i9xx_plane), intel_de_write_fw(dev_priv, DSPPOS(i9xx_plane),
(crtc_y << 16) | crtc_x); DISP_POS_Y(crtc_y) | DISP_POS_X(crtc_x));
intel_de_write_fw(dev_priv, DSPSIZE(i9xx_plane), intel_de_write_fw(dev_priv, DSPSIZE(i9xx_plane),
((crtc_h - 1) << 16) | (crtc_w - 1)); DISP_HEIGHT(crtc_h - 1) | DISP_WIDTH(crtc_w - 1));
} }
spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
...@@ -474,20 +474,20 @@ static void i9xx_plane_update_arm(struct intel_plane *plane, ...@@ -474,20 +474,20 @@ static void i9xx_plane_update_arm(struct intel_plane *plane,
int crtc_h = drm_rect_height(&plane_state->uapi.dst); int crtc_h = drm_rect_height(&plane_state->uapi.dst);
intel_de_write_fw(dev_priv, PRIMPOS(i9xx_plane), intel_de_write_fw(dev_priv, PRIMPOS(i9xx_plane),
(crtc_y << 16) | crtc_x); PRIM_POS_Y(crtc_y) | PRIM_POS_X(crtc_x));
intel_de_write_fw(dev_priv, PRIMSIZE(i9xx_plane), intel_de_write_fw(dev_priv, PRIMSIZE(i9xx_plane),
((crtc_h - 1) << 16) | (crtc_w - 1)); PRIM_HEIGHT(crtc_h - 1) | PRIM_WIDTH(crtc_w - 1));
intel_de_write_fw(dev_priv, PRIMCNSTALPHA(i9xx_plane), 0); intel_de_write_fw(dev_priv, PRIMCNSTALPHA(i9xx_plane), 0);
} }
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) { if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
intel_de_write_fw(dev_priv, DSPOFFSET(i9xx_plane), intel_de_write_fw(dev_priv, DSPOFFSET(i9xx_plane),
(y << 16) | x); DISP_OFFSET_Y(y) | DISP_OFFSET_X(x));
} else if (DISPLAY_VER(dev_priv) >= 4) { } else if (DISPLAY_VER(dev_priv) >= 4) {
intel_de_write_fw(dev_priv, DSPLINOFF(i9xx_plane), intel_de_write_fw(dev_priv, DSPLINOFF(i9xx_plane),
linear_offset); linear_offset);
intel_de_write_fw(dev_priv, DSPTILEOFF(i9xx_plane), intel_de_write_fw(dev_priv, DSPTILEOFF(i9xx_plane),
(y << 16) | x); DISP_OFFSET_Y(y) | DISP_OFFSET_X(x));
} }
/* /*
...@@ -564,7 +564,7 @@ g4x_primary_async_flip(struct intel_plane *plane, ...@@ -564,7 +564,7 @@ g4x_primary_async_flip(struct intel_plane *plane,
unsigned long irqflags; unsigned long irqflags;
if (async_flip) if (async_flip)
dspcntr |= DISPPLANE_ASYNC_FLIP; dspcntr |= DISP_ASYNC_FLIP;
spin_lock_irqsave(&dev_priv->uncore.lock, irqflags); spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
intel_de_write_fw(dev_priv, DSPCNTR(i9xx_plane), dspcntr); intel_de_write_fw(dev_priv, DSPCNTR(i9xx_plane), dspcntr);
...@@ -696,13 +696,12 @@ static bool i9xx_plane_get_hw_state(struct intel_plane *plane, ...@@ -696,13 +696,12 @@ static bool i9xx_plane_get_hw_state(struct intel_plane *plane,
val = intel_de_read(dev_priv, DSPCNTR(i9xx_plane)); val = intel_de_read(dev_priv, DSPCNTR(i9xx_plane));
ret = val & DISPLAY_PLANE_ENABLE; ret = val & DISP_ENABLE;
if (DISPLAY_VER(dev_priv) >= 5) if (DISPLAY_VER(dev_priv) >= 5)
*pipe = plane->pipe; *pipe = plane->pipe;
else else
*pipe = (val & DISPPLANE_SEL_PIPE_MASK) >> *pipe = REG_FIELD_GET(DISP_PIPE_SEL_MASK, val);
DISPPLANE_SEL_PIPE_SHIFT;
intel_display_power_put(dev_priv, power_domain, wakeref); intel_display_power_put(dev_priv, power_domain, wakeref);
...@@ -958,32 +957,32 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) ...@@ -958,32 +957,32 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe)
static int i9xx_format_to_fourcc(int format) static int i9xx_format_to_fourcc(int format)
{ {
switch (format) { switch (format) {
case DISPPLANE_8BPP: case DISP_FORMAT_8BPP:
return DRM_FORMAT_C8; return DRM_FORMAT_C8;
case DISPPLANE_BGRA555: case DISP_FORMAT_BGRA555:
return DRM_FORMAT_ARGB1555; return DRM_FORMAT_ARGB1555;
case DISPPLANE_BGRX555: case DISP_FORMAT_BGRX555:
return DRM_FORMAT_XRGB1555; return DRM_FORMAT_XRGB1555;
case DISPPLANE_BGRX565: case DISP_FORMAT_BGRX565:
return DRM_FORMAT_RGB565; return DRM_FORMAT_RGB565;
default: default:
case DISPPLANE_BGRX888: case DISP_FORMAT_BGRX888:
return DRM_FORMAT_XRGB8888; return DRM_FORMAT_XRGB8888;
case DISPPLANE_RGBX888: case DISP_FORMAT_RGBX888:
return DRM_FORMAT_XBGR8888; return DRM_FORMAT_XBGR8888;
case DISPPLANE_BGRA888: case DISP_FORMAT_BGRA888:
return DRM_FORMAT_ARGB8888; return DRM_FORMAT_ARGB8888;
case DISPPLANE_RGBA888: case DISP_FORMAT_RGBA888:
return DRM_FORMAT_ABGR8888; return DRM_FORMAT_ABGR8888;
case DISPPLANE_BGRX101010: case DISP_FORMAT_BGRX101010:
return DRM_FORMAT_XRGB2101010; return DRM_FORMAT_XRGB2101010;
case DISPPLANE_RGBX101010: case DISP_FORMAT_RGBX101010:
return DRM_FORMAT_XBGR2101010; return DRM_FORMAT_XBGR2101010;
case DISPPLANE_BGRA101010: case DISP_FORMAT_BGRA101010:
return DRM_FORMAT_ARGB2101010; return DRM_FORMAT_ARGB2101010;
case DISPPLANE_RGBA101010: case DISP_FORMAT_RGBA101010:
return DRM_FORMAT_ABGR2101010; return DRM_FORMAT_ABGR2101010;
case DISPPLANE_RGBX161616: case DISP_FORMAT_RGBX161616:
return DRM_FORMAT_XBGR16161616F; return DRM_FORMAT_XBGR16161616F;
} }
} }
...@@ -1021,26 +1020,26 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc, ...@@ -1021,26 +1020,26 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
val = intel_de_read(dev_priv, DSPCNTR(i9xx_plane)); val = intel_de_read(dev_priv, DSPCNTR(i9xx_plane));
if (DISPLAY_VER(dev_priv) >= 4) { if (DISPLAY_VER(dev_priv) >= 4) {
if (val & DISPPLANE_TILED) { if (val & DISP_TILED) {
plane_config->tiling = I915_TILING_X; plane_config->tiling = I915_TILING_X;
fb->modifier = I915_FORMAT_MOD_X_TILED; fb->modifier = I915_FORMAT_MOD_X_TILED;
} }
if (val & DISPPLANE_ROTATE_180) if (val & DISP_ROTATE_180)
plane_config->rotation = DRM_MODE_ROTATE_180; plane_config->rotation = DRM_MODE_ROTATE_180;
} }
if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B && if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B &&
val & DISPPLANE_MIRROR) val & DISP_MIRROR)
plane_config->rotation |= DRM_MODE_REFLECT_X; plane_config->rotation |= DRM_MODE_REFLECT_X;
pixel_format = val & DISPPLANE_PIXFORMAT_MASK; pixel_format = val & DISP_FORMAT_MASK;
fourcc = i9xx_format_to_fourcc(pixel_format); fourcc = i9xx_format_to_fourcc(pixel_format);
fb->format = drm_format_info(fourcc); fb->format = drm_format_info(fourcc);
if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) { if (IS_HASWELL(dev_priv) || IS_BROADWELL(dev_priv)) {
offset = intel_de_read(dev_priv, DSPOFFSET(i9xx_plane)); offset = intel_de_read(dev_priv, DSPOFFSET(i9xx_plane));
base = intel_de_read(dev_priv, DSPSURF(i9xx_plane)) & 0xfffff000; base = intel_de_read(dev_priv, DSPSURF(i9xx_plane)) & DISP_ADDR_MASK;
} else if (DISPLAY_VER(dev_priv) >= 4) { } else if (DISPLAY_VER(dev_priv) >= 4) {
if (plane_config->tiling) if (plane_config->tiling)
offset = intel_de_read(dev_priv, offset = intel_de_read(dev_priv,
...@@ -1048,7 +1047,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc, ...@@ -1048,7 +1047,7 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
else else
offset = intel_de_read(dev_priv, offset = intel_de_read(dev_priv,
DSPLINOFF(i9xx_plane)); DSPLINOFF(i9xx_plane));
base = intel_de_read(dev_priv, DSPSURF(i9xx_plane)) & 0xfffff000; base = intel_de_read(dev_priv, DSPSURF(i9xx_plane)) & DISP_ADDR_MASK;
} else { } else {
base = intel_de_read(dev_priv, DSPADDR(i9xx_plane)); base = intel_de_read(dev_priv, DSPADDR(i9xx_plane));
} }
......
...@@ -3543,11 +3543,11 @@ static void i9xx_get_pipe_color_config(struct intel_crtc_state *crtc_state) ...@@ -3543,11 +3543,11 @@ static void i9xx_get_pipe_color_config(struct intel_crtc_state *crtc_state)
tmp = intel_de_read(dev_priv, DSPCNTR(i9xx_plane)); tmp = intel_de_read(dev_priv, DSPCNTR(i9xx_plane));
if (tmp & DISPPLANE_GAMMA_ENABLE) if (tmp & DISP_PIPE_GAMMA_ENABLE)
crtc_state->gamma_enable = true; crtc_state->gamma_enable = true;
if (!HAS_GMCH(dev_priv) && if (!HAS_GMCH(dev_priv) &&
tmp & DISPPLANE_PIPE_CSC_ENABLE) tmp & DISP_PIPE_CSC_ENABLE)
crtc_state->csc_enable = true; crtc_state->csc_enable = true;
} }
...@@ -9995,14 +9995,11 @@ void i830_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe) ...@@ -9995,14 +9995,11 @@ void i830_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe)
pipe_name(pipe)); pipe_name(pipe));
drm_WARN_ON(&dev_priv->drm, drm_WARN_ON(&dev_priv->drm,
intel_de_read(dev_priv, DSPCNTR(PLANE_A)) & intel_de_read(dev_priv, DSPCNTR(PLANE_A)) & DISP_ENABLE);
DISPLAY_PLANE_ENABLE);
drm_WARN_ON(&dev_priv->drm, drm_WARN_ON(&dev_priv->drm,
intel_de_read(dev_priv, DSPCNTR(PLANE_B)) & intel_de_read(dev_priv, DSPCNTR(PLANE_B)) & DISP_ENABLE);
DISPLAY_PLANE_ENABLE);
drm_WARN_ON(&dev_priv->drm, drm_WARN_ON(&dev_priv->drm,
intel_de_read(dev_priv, DSPCNTR(PLANE_C)) & intel_de_read(dev_priv, DSPCNTR(PLANE_C)) & DISP_ENABLE);
DISPLAY_PLANE_ENABLE);
drm_WARN_ON(&dev_priv->drm, drm_WARN_ON(&dev_priv->drm,
intel_de_read(dev_priv, CURCNTR(PIPE_A)) & MCURSOR_MODE_MASK); intel_de_read(dev_priv, CURCNTR(PIPE_A)) & MCURSOR_MODE_MASK);
drm_WARN_ON(&dev_priv->drm, drm_WARN_ON(&dev_priv->drm,
......
...@@ -185,7 +185,7 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) ...@@ -185,7 +185,7 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
vgpu_vreg_t(vgpu, PIPECONF(pipe)) &= vgpu_vreg_t(vgpu, PIPECONF(pipe)) &=
~(PIPECONF_ENABLE | I965_PIPECONF_ACTIVE); ~(PIPECONF_ENABLE | I965_PIPECONF_ACTIVE);
vgpu_vreg_t(vgpu, DSPCNTR(pipe)) &= ~DISPLAY_PLANE_ENABLE; vgpu_vreg_t(vgpu, DSPCNTR(pipe)) &= ~DISP_ENABLE;
vgpu_vreg_t(vgpu, SPRCTL(pipe)) &= ~SPRITE_ENABLE; vgpu_vreg_t(vgpu, SPRCTL(pipe)) &= ~SPRITE_ENABLE;
vgpu_vreg_t(vgpu, CURCNTR(pipe)) &= ~MCURSOR_MODE_MASK; vgpu_vreg_t(vgpu, CURCNTR(pipe)) &= ~MCURSOR_MODE_MASK;
vgpu_vreg_t(vgpu, CURCNTR(pipe)) |= MCURSOR_MODE_DISABLE; vgpu_vreg_t(vgpu, CURCNTR(pipe)) |= MCURSOR_MODE_DISABLE;
...@@ -496,7 +496,7 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu) ...@@ -496,7 +496,7 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
/* Disable Primary/Sprite/Cursor plane */ /* Disable Primary/Sprite/Cursor plane */
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
vgpu_vreg_t(vgpu, DSPCNTR(pipe)) &= ~DISPLAY_PLANE_ENABLE; vgpu_vreg_t(vgpu, DSPCNTR(pipe)) &= ~DISP_ENABLE;
vgpu_vreg_t(vgpu, SPRCTL(pipe)) &= ~SPRITE_ENABLE; vgpu_vreg_t(vgpu, SPRCTL(pipe)) &= ~SPRITE_ENABLE;
vgpu_vreg_t(vgpu, CURCNTR(pipe)) &= ~MCURSOR_MODE_MASK; vgpu_vreg_t(vgpu, CURCNTR(pipe)) &= ~MCURSOR_MODE_MASK;
vgpu_vreg_t(vgpu, CURCNTR(pipe)) |= MCURSOR_MODE_DISABLE; vgpu_vreg_t(vgpu, CURCNTR(pipe)) |= MCURSOR_MODE_DISABLE;
......
...@@ -83,22 +83,22 @@ static int bdw_format_to_drm(int format) ...@@ -83,22 +83,22 @@ static int bdw_format_to_drm(int format)
int bdw_pixel_formats_index = 6; int bdw_pixel_formats_index = 6;
switch (format) { switch (format) {
case DISPPLANE_8BPP: case DISP_FORMAT_8BPP:
bdw_pixel_formats_index = 0; bdw_pixel_formats_index = 0;
break; break;
case DISPPLANE_BGRX565: case DISP_FORMAT_BGRX565:
bdw_pixel_formats_index = 1; bdw_pixel_formats_index = 1;
break; break;
case DISPPLANE_BGRX888: case DISP_FORMAT_BGRX888:
bdw_pixel_formats_index = 2; bdw_pixel_formats_index = 2;
break; break;
case DISPPLANE_RGBX101010: case DISP_FORMAT_RGBX101010:
bdw_pixel_formats_index = 3; bdw_pixel_formats_index = 3;
break; break;
case DISPPLANE_BGRX101010: case DISP_FORMAT_BGRX101010:
bdw_pixel_formats_index = 4; bdw_pixel_formats_index = 4;
break; break;
case DISPPLANE_RGBX888: case DISP_FORMAT_RGBX888:
bdw_pixel_formats_index = 5; bdw_pixel_formats_index = 5;
break; break;
...@@ -211,7 +211,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, ...@@ -211,7 +211,7 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu,
return -ENODEV; return -ENODEV;
val = vgpu_vreg_t(vgpu, DSPCNTR(pipe)); val = vgpu_vreg_t(vgpu, DSPCNTR(pipe));
plane->enabled = !!(val & DISPLAY_PLANE_ENABLE); plane->enabled = !!(val & DISP_ENABLE);
if (!plane->enabled) if (!plane->enabled)
return -ENODEV; return -ENODEV;
...@@ -231,8 +231,8 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu, ...@@ -231,8 +231,8 @@ int intel_vgpu_decode_primary_plane(struct intel_vgpu *vgpu,
plane->bpp = skl_pixel_formats[fmt].bpp; plane->bpp = skl_pixel_formats[fmt].bpp;
plane->drm_format = skl_pixel_formats[fmt].drm_format; plane->drm_format = skl_pixel_formats[fmt].drm_format;
} else { } else {
plane->tiled = val & DISPPLANE_TILED; plane->tiled = val & DISP_TILED;
fmt = bdw_format_to_drm(val & DISPPLANE_PIXFORMAT_MASK); fmt = bdw_format_to_drm(val & DISP_FORMAT_MASK);
plane->bpp = bdw_pixel_formats[fmt].bpp; plane->bpp = bdw_pixel_formats[fmt].bpp;
plane->drm_format = bdw_pixel_formats[fmt].drm_format; plane->drm_format = bdw_pixel_formats[fmt].drm_format;
} }
......
...@@ -5826,49 +5826,54 @@ enum { ...@@ -5826,49 +5826,54 @@ enum {
/* Display A control */ /* Display A control */
#define _DSPAADDR_VLV 0x7017C /* vlv/chv */ #define _DSPAADDR_VLV 0x7017C /* vlv/chv */
#define _DSPACNTR 0x70180 #define _DSPACNTR 0x70180
#define DISPLAY_PLANE_ENABLE (1 << 31) #define DISP_ENABLE REG_BIT(31)
#define DISPLAY_PLANE_DISABLE 0 #define DISP_PIPE_GAMMA_ENABLE REG_BIT(30)
#define DISPPLANE_GAMMA_ENABLE (1 << 30) #define DISP_FORMAT_MASK REG_GENMASK(29, 26)
#define DISPPLANE_GAMMA_DISABLE 0 #define DISP_FORMAT_8BPP REG_FIELD_PREP(DISP_FORMAT_MASK, 2)
#define DISPPLANE_PIXFORMAT_MASK (0xf << 26) #define DISP_FORMAT_BGRA555 REG_FIELD_PREP(DISP_FORMAT_MASK, 3)
#define DISPPLANE_YUV422 (0x0 << 26) #define DISP_FORMAT_BGRX555 REG_FIELD_PREP(DISP_FORMAT_MASK, 4)
#define DISPPLANE_8BPP (0x2 << 26) #define DISP_FORMAT_BGRX565 REG_FIELD_PREP(DISP_FORMAT_MASK, 5)
#define DISPPLANE_BGRA555 (0x3 << 26) #define DISP_FORMAT_BGRX888 REG_FIELD_PREP(DISP_FORMAT_MASK, 6)
#define DISPPLANE_BGRX555 (0x4 << 26) #define DISP_FORMAT_BGRA888 REG_FIELD_PREP(DISP_FORMAT_MASK, 7)
#define DISPPLANE_BGRX565 (0x5 << 26) #define DISP_FORMAT_RGBX101010 REG_FIELD_PREP(DISP_FORMAT_MASK, 8)
#define DISPPLANE_BGRX888 (0x6 << 26) #define DISP_FORMAT_RGBA101010 REG_FIELD_PREP(DISP_FORMAT_MASK, 9)
#define DISPPLANE_BGRA888 (0x7 << 26) #define DISP_FORMAT_BGRX101010 REG_FIELD_PREP(DISP_FORMAT_MASK, 10)
#define DISPPLANE_RGBX101010 (0x8 << 26) #define DISP_FORMAT_BGRA101010 REG_FIELD_PREP(DISP_FORMAT_MASK, 11)
#define DISPPLANE_RGBA101010 (0x9 << 26) #define DISP_FORMAT_RGBX161616 REG_FIELD_PREP(DISP_FORMAT_MASK, 12)
#define DISPPLANE_BGRX101010 (0xa << 26) #define DISP_FORMAT_RGBX888 REG_FIELD_PREP(DISP_FORMAT_MASK, 14)
#define DISPPLANE_BGRA101010 (0xb << 26) #define DISP_FORMAT_RGBA888 REG_FIELD_PREP(DISP_FORMAT_MASK, 15)
#define DISPPLANE_RGBX161616 (0xc << 26) #define DISP_STEREO_ENABLE REG_BIT(25)
#define DISPPLANE_RGBX888 (0xe << 26) #define DISP_PIPE_CSC_ENABLE REG_BIT(24) /* ilk+ */
#define DISPPLANE_RGBA888 (0xf << 26) #define DISP_PIPE_SEL_MASK REG_GENMASK(25, 24)
#define DISPPLANE_STEREO_ENABLE (1 << 25) #define DISP_PIPE_SEL(pipe) REG_FIELD_PREP(DISP_PIPE_SEL_MASK, (pipe))
#define DISPPLANE_STEREO_DISABLE 0 #define DISP_SRC_KEY_ENABLE REG_BIT(22)
#define DISPPLANE_PIPE_CSC_ENABLE (1 << 24) /* ilk+ */ #define DISP_LINE_DOUBLE REG_BIT(20)
#define DISPPLANE_SEL_PIPE_SHIFT 24 #define DISP_STEREO_POLARITY_SECOND REG_BIT(18)
#define DISPPLANE_SEL_PIPE_MASK (3 << DISPPLANE_SEL_PIPE_SHIFT) #define DISP_ALPHA_PREMULTIPLY REG_BIT(16) /* CHV pipe B */
#define DISPPLANE_SEL_PIPE(pipe) ((pipe) << DISPPLANE_SEL_PIPE_SHIFT) #define DISP_ROTATE_180 REG_BIT(15)
#define DISPPLANE_SRC_KEY_ENABLE (1 << 22) #define DISP_TRICKLE_FEED_DISABLE REG_BIT(14) /* g4x+ */
#define DISPPLANE_SRC_KEY_DISABLE 0 #define DISP_TILED REG_BIT(10)
#define DISPPLANE_LINE_DOUBLE (1 << 20) #define DISP_ASYNC_FLIP REG_BIT(9) /* g4x+ */
#define DISPPLANE_NO_LINE_DOUBLE 0 #define DISP_MIRROR REG_BIT(8) /* CHV pipe B */
#define DISPPLANE_STEREO_POLARITY_FIRST 0
#define DISPPLANE_STEREO_POLARITY_SECOND (1 << 18)
#define DISPPLANE_ALPHA_PREMULTIPLY (1 << 16) /* CHV pipe B */
#define DISPPLANE_ROTATE_180 (1 << 15)
#define DISPPLANE_TRICKLE_FEED_DISABLE (1 << 14) /* Ironlake */
#define DISPPLANE_TILED (1 << 10)
#define DISPPLANE_ASYNC_FLIP (1 << 9) /* g4x+ */
#define DISPPLANE_MIRROR (1 << 8) /* CHV pipe B */
#define _DSPAADDR 0x70184 #define _DSPAADDR 0x70184
#define _DSPASTRIDE 0x70188 #define _DSPASTRIDE 0x70188
#define _DSPAPOS 0x7018C /* reserved */ #define _DSPAPOS 0x7018C /* reserved */
#define DISP_POS_Y_MASK REG_GENMASK(31, 0)
#define DISP_POS_Y(y) REG_FIELD_PREP(DISP_POS_Y_MASK, (y))
#define DISP_POS_X_MASK REG_GENMASK(15, 0)
#define DISP_POS_X(x) REG_FIELD_PREP(DISP_POS_X_MASK, (x))
#define _DSPASIZE 0x70190 #define _DSPASIZE 0x70190
#define DISP_HEIGHT_MASK REG_GENMASK(31, 0)
#define DISP_HEIGHT(h) REG_FIELD_PREP(DISP_HEIGHT_MASK, (h))
#define DISP_WIDTH_MASK REG_GENMASK(15, 0)
#define DISP_WIDTH(w) REG_FIELD_PREP(DISP_WIDTH_MASK, (w))
#define _DSPASURF 0x7019C /* 965+ only */ #define _DSPASURF 0x7019C /* 965+ only */
#define DISP_ADDR_MASK REG_GENMASK(31, 12)
#define _DSPATILEOFF 0x701A4 /* 965+ only */ #define _DSPATILEOFF 0x701A4 /* 965+ only */
#define DISP_OFFSET_Y_MASK REG_GENMASK(31, 16)
#define DISP_OFFSET_Y(y) REG_FIELD_PREP(DISP_OFFSET_Y_MASK, (y))
#define DISP_OFFSET_X_MASK REG_GENMASK(15, 0)
#define DISP_OFFSET_X(x) REG_FIELD_PREP(DISP_OFFSET_X_MASK, (x))
#define _DSPAOFFSET 0x701A4 /* HSW */ #define _DSPAOFFSET 0x701A4 /* HSW */
#define _DSPASURFLIVE 0x701AC #define _DSPASURFLIVE 0x701AC
#define _DSPAGAMC 0x701E0 #define _DSPAGAMC 0x701E0
...@@ -5888,15 +5893,28 @@ enum { ...@@ -5888,15 +5893,28 @@ enum {
/* CHV pipe B blender and primary plane */ /* CHV pipe B blender and primary plane */
#define _CHV_BLEND_A 0x60a00 #define _CHV_BLEND_A 0x60a00
#define CHV_BLEND_LEGACY (0 << 30) #define CHV_BLEND_MASK REG_GENMASK(31, 30)
#define CHV_BLEND_ANDROID (1 << 30) #define CHV_BLEND_LEGACY REG_FIELD_PREP(CHV_BLEND_MASK, 0)
#define CHV_BLEND_MPO (2 << 30) #define CHV_BLEND_ANDROID REG_FIELD_PREP(CHV_BLEND_MASK, 1)
#define CHV_BLEND_MASK (3 << 30) #define CHV_BLEND_MPO REG_FIELD_PREP(CHV_BLEND_MASK, 2)
#define _CHV_CANVAS_A 0x60a04 #define _CHV_CANVAS_A 0x60a04
#define CHV_CANVAS_RED_MASK REG_GENMASK(29, 20)
#define CHV_CANVAS_GREEN_MASK REG_GENMASK(19, 10)
#define CHV_CANVAS_BLUE_MASK REG_GENMASK(9, 0)
#define _PRIMPOS_A 0x60a08 #define _PRIMPOS_A 0x60a08
#define PRIM_POS_Y_MASK REG_GENMASK(31, 16)
#define PRIM_POS_Y(y) REG_FIELD_PREP(PRIM_POS_Y_MASK, (y))
#define PRIM_POS_X_MASK REG_GENMASK(15, 0)
#define PRIM_POS_X(x) REG_FIELD_PREP(PRIM_POS_X_MASK, (x))
#define _PRIMSIZE_A 0x60a0c #define _PRIMSIZE_A 0x60a0c
#define PRIM_HEIGHT_MASK REG_GENMASK(31, 16)
#define PRIM_HEIGHT(h) REG_FIELD_PREP(PRIM_HEIGHT_MASK, (h))
#define PRIM_WIDTH_MASK REG_GENMASK(15, 0)
#define PRIM_WIDTH(w) REG_FIELD_PREP(PRIM_WIDTH_MASK, (w))
#define _PRIMCNSTALPHA_A 0x60a10 #define _PRIMCNSTALPHA_A 0x60a10
#define PRIM_CONST_ALPHA_ENABLE (1 << 31) #define PRIM_CONST_ALPHA_ENABLE REG_BIT(31)
#define PRIM_CONST_ALPHA_MASK REG_GENMASK(7, 0)
#define PRIM_CONST_ALPHA(alpha) REG_FIELD_PREP(PRIM_CONST_ALPHA_MASK, (alpha))
#define CHV_BLEND(pipe) _MMIO_TRANS2(pipe, _CHV_BLEND_A) #define CHV_BLEND(pipe) _MMIO_TRANS2(pipe, _CHV_BLEND_A)
#define CHV_CANVAS(pipe) _MMIO_TRANS2(pipe, _CHV_CANVAS_A) #define CHV_CANVAS(pipe) _MMIO_TRANS2(pipe, _CHV_CANVAS_A)
...@@ -5937,10 +5955,8 @@ enum { ...@@ -5937,10 +5955,8 @@ enum {
/* Display B control */ /* Display B control */
#define _DSPBCNTR (DISPLAY_MMIO_BASE(dev_priv) + 0x71180) #define _DSPBCNTR (DISPLAY_MMIO_BASE(dev_priv) + 0x71180)
#define DISPPLANE_ALPHA_TRANS_ENABLE (1 << 15) #define DISP_ALPHA_TRANS_ENABLE REG_BIT(15)
#define DISPPLANE_ALPHA_TRANS_DISABLE 0 #define DISP_SPRITE_ABOVE_OVERLAY REG_BIT(0)
#define DISPPLANE_SPRITE_ABOVE_DISPLAY 0
#define DISPPLANE_SPRITE_ABOVE_OVERLAY (1)
#define _DSPBADDR (DISPLAY_MMIO_BASE(dev_priv) + 0x71184) #define _DSPBADDR (DISPLAY_MMIO_BASE(dev_priv) + 0x71184)
#define _DSPBSTRIDE (DISPLAY_MMIO_BASE(dev_priv) + 0x71188) #define _DSPBSTRIDE (DISPLAY_MMIO_BASE(dev_priv) + 0x71188)
#define _DSPBPOS (DISPLAY_MMIO_BASE(dev_priv) + 0x7118C) #define _DSPBPOS (DISPLAY_MMIO_BASE(dev_priv) + 0x7118C)
......
...@@ -7208,7 +7208,7 @@ static void g4x_disable_trickle_feed(struct drm_i915_private *dev_priv) ...@@ -7208,7 +7208,7 @@ static void g4x_disable_trickle_feed(struct drm_i915_private *dev_priv)
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
intel_uncore_write(&dev_priv->uncore, DSPCNTR(pipe), intel_uncore_write(&dev_priv->uncore, DSPCNTR(pipe),
intel_uncore_read(&dev_priv->uncore, DSPCNTR(pipe)) | intel_uncore_read(&dev_priv->uncore, DSPCNTR(pipe)) |
DISPPLANE_TRICKLE_FEED_DISABLE); DISP_TRICKLE_FEED_DISABLE);
intel_uncore_write(&dev_priv->uncore, DSPSURF(pipe), intel_uncore_read(&dev_priv->uncore, DSPSURF(pipe))); intel_uncore_write(&dev_priv->uncore, DSPSURF(pipe), intel_uncore_read(&dev_priv->uncore, DSPSURF(pipe)));
intel_uncore_posting_read(&dev_priv->uncore, DSPSURF(pipe)); intel_uncore_posting_read(&dev_priv->uncore, DSPSURF(pipe));
......
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