|
@@ -3432,20 +3432,11 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)
|
|
|
case DRM_FORMAT_RGB565:
|
|
|
return PLANE_CTL_FORMAT_RGB_565;
|
|
|
case DRM_FORMAT_XBGR8888:
|
|
|
+ case DRM_FORMAT_ABGR8888:
|
|
|
return PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ORDER_RGBX;
|
|
|
case DRM_FORMAT_XRGB8888:
|
|
|
- return PLANE_CTL_FORMAT_XRGB_8888;
|
|
|
- /*
|
|
|
- * XXX: For ARBG/ABGR formats we default to expecting scanout buffers
|
|
|
- * to be already pre-multiplied. We need to add a knob (or a different
|
|
|
- * DRM_FORMAT) for user-space to configure that.
|
|
|
- */
|
|
|
- case DRM_FORMAT_ABGR8888:
|
|
|
- return PLANE_CTL_FORMAT_XRGB_8888 | PLANE_CTL_ORDER_RGBX |
|
|
|
- PLANE_CTL_ALPHA_SW_PREMULTIPLY;
|
|
|
case DRM_FORMAT_ARGB8888:
|
|
|
- return PLANE_CTL_FORMAT_XRGB_8888 |
|
|
|
- PLANE_CTL_ALPHA_SW_PREMULTIPLY;
|
|
|
+ return PLANE_CTL_FORMAT_XRGB_8888;
|
|
|
case DRM_FORMAT_XRGB2101010:
|
|
|
return PLANE_CTL_FORMAT_XRGB_2101010;
|
|
|
case DRM_FORMAT_XBGR2101010:
|
|
@@ -3465,6 +3456,33 @@ static u32 skl_plane_ctl_format(uint32_t pixel_format)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * XXX: For ARBG/ABGR formats we default to expecting scanout buffers
|
|
|
+ * to be already pre-multiplied. We need to add a knob (or a different
|
|
|
+ * DRM_FORMAT) for user-space to configure that.
|
|
|
+ */
|
|
|
+static u32 skl_plane_ctl_alpha(uint32_t pixel_format)
|
|
|
+{
|
|
|
+ switch (pixel_format) {
|
|
|
+ case DRM_FORMAT_ABGR8888:
|
|
|
+ case DRM_FORMAT_ARGB8888:
|
|
|
+ return PLANE_CTL_ALPHA_SW_PREMULTIPLY;
|
|
|
+ default:
|
|
|
+ return PLANE_CTL_ALPHA_DISABLE;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+static u32 glk_plane_color_ctl_alpha(uint32_t pixel_format)
|
|
|
+{
|
|
|
+ switch (pixel_format) {
|
|
|
+ case DRM_FORMAT_ABGR8888:
|
|
|
+ case DRM_FORMAT_ARGB8888:
|
|
|
+ return PLANE_COLOR_ALPHA_SW_PREMULTIPLY;
|
|
|
+ default:
|
|
|
+ return PLANE_COLOR_ALPHA_DISABLE;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
static u32 skl_plane_ctl_tiling(uint64_t fb_modifier)
|
|
|
{
|
|
|
switch (fb_modifier) {
|
|
@@ -3521,7 +3539,8 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
|
|
|
|
|
|
plane_ctl = PLANE_CTL_ENABLE;
|
|
|
|
|
|
- if (!IS_GEMINILAKE(dev_priv) && !IS_CANNONLAKE(dev_priv)) {
|
|
|
+ if (INTEL_GEN(dev_priv) < 10 && !IS_GEMINILAKE(dev_priv)) {
|
|
|
+ plane_ctl |= skl_plane_ctl_alpha(fb->format->format);
|
|
|
plane_ctl |=
|
|
|
PLANE_CTL_PIPE_GAMMA_ENABLE |
|
|
|
PLANE_CTL_PIPE_CSC_ENABLE |
|
|
@@ -3540,6 +3559,20 @@ u32 skl_plane_ctl(const struct intel_crtc_state *crtc_state,
|
|
|
return plane_ctl;
|
|
|
}
|
|
|
|
|
|
+u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
|
|
|
+ const struct intel_plane_state *plane_state)
|
|
|
+{
|
|
|
+ const struct drm_framebuffer *fb = plane_state->base.fb;
|
|
|
+ u32 plane_color_ctl = 0;
|
|
|
+
|
|
|
+ plane_color_ctl |= PLANE_COLOR_PIPE_GAMMA_ENABLE;
|
|
|
+ plane_color_ctl |= PLANE_COLOR_PIPE_CSC_ENABLE;
|
|
|
+ plane_color_ctl |= PLANE_COLOR_PLANE_GAMMA_DISABLE;
|
|
|
+ plane_color_ctl |= glk_plane_color_ctl_alpha(fb->format->format);
|
|
|
+
|
|
|
+ return plane_color_ctl;
|
|
|
+}
|
|
|
+
|
|
|
static int
|
|
|
__intel_display_resume(struct drm_device *dev,
|
|
|
struct drm_atomic_state *state,
|
|
@@ -8426,7 +8459,7 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
|
|
|
{
|
|
|
struct drm_device *dev = crtc->base.dev;
|
|
|
struct drm_i915_private *dev_priv = to_i915(dev);
|
|
|
- u32 val, base, offset, stride_mult, tiling;
|
|
|
+ u32 val, base, offset, stride_mult, tiling, alpha;
|
|
|
int pipe = crtc->pipe;
|
|
|
int fourcc, pixel_format;
|
|
|
unsigned int aligned_height;
|
|
@@ -8448,9 +8481,16 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
|
|
|
goto error;
|
|
|
|
|
|
pixel_format = val & PLANE_CTL_FORMAT_MASK;
|
|
|
+
|
|
|
+ if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv)) {
|
|
|
+ alpha = I915_READ(PLANE_COLOR_CTL(pipe, 0));
|
|
|
+ alpha &= PLANE_COLOR_ALPHA_MASK;
|
|
|
+ } else {
|
|
|
+ alpha = val & PLANE_CTL_ALPHA_MASK;
|
|
|
+ }
|
|
|
+
|
|
|
fourcc = skl_format_to_fourcc(pixel_format,
|
|
|
- val & PLANE_CTL_ORDER_RGBX,
|
|
|
- val & PLANE_CTL_ALPHA_MASK);
|
|
|
+ val & PLANE_CTL_ORDER_RGBX, alpha);
|
|
|
fb->format = drm_format_info(fourcc);
|
|
|
|
|
|
tiling = val & PLANE_CTL_TILED_MASK;
|
|
@@ -12853,6 +12893,9 @@ intel_check_primary_plane(struct intel_plane *plane,
|
|
|
state->ctl = i9xx_plane_ctl(crtc_state, state);
|
|
|
}
|
|
|
|
|
|
+ if (INTEL_GEN(dev_priv) >= 10 || IS_GEMINILAKE(dev_priv))
|
|
|
+ state->color_ctl = glk_plane_color_ctl(crtc_state, state);
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|