return dfixed_frac(inf);
}
+static void tegra_plane_setup_blending_legacy(struct tegra_plane *plane)
+{
+ /*
+ * Disable blending and assume Window A is the bottom-most window,
+ * Window C is the top-most window and Window B is in the middle.
+ */
+ tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_NOKEY);
+ tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_1WIN);
+
+ switch (plane->index) {
+ case 0:
+ tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_2WIN_X);
+ tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_2WIN_Y);
+ tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_3WIN_XY);
+ break;
+
+ case 1:
+ tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_2WIN_X);
+ tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_2WIN_Y);
+ tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_3WIN_XY);
+ break;
+
+ case 2:
+ tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_2WIN_X);
+ tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_2WIN_Y);
+ tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_3WIN_XY);
+ break;
+ }
+}
+
+static void tegra_plane_setup_blending(struct tegra_plane *plane,
+ const struct tegra_dc_window *window)
+{
+ u32 value;
+
+ value = BLEND_FACTOR_DST_ALPHA_ZERO | BLEND_FACTOR_SRC_ALPHA_K2 |
+ BLEND_FACTOR_DST_COLOR_NEG_K1_TIMES_SRC |
+ BLEND_FACTOR_SRC_COLOR_K1_TIMES_SRC;
+ tegra_plane_writel(plane, value, DC_WIN_BLEND_MATCH_SELECT);
+
+ value = BLEND_FACTOR_DST_ALPHA_ZERO | BLEND_FACTOR_SRC_ALPHA_K2 |
+ BLEND_FACTOR_DST_COLOR_NEG_K1_TIMES_SRC |
+ BLEND_FACTOR_SRC_COLOR_K1_TIMES_SRC;
+ tegra_plane_writel(plane, value, DC_WIN_BLEND_NOMATCH_SELECT);
+
+ value = K2(255) | K1(255) | WINDOW_LAYER_DEPTH(255 - window->zpos);
+ tegra_plane_writel(plane, value, DC_WIN_BLEND_LAYER_CONTROL);
+}
+
static void tegra_dc_setup_window(struct tegra_plane *plane,
const struct tegra_dc_window *window)
{
tegra_plane_writel(plane, value, DC_WIN_WIN_OPTIONS);
- /*
- * Disable blending and assume Window A is the bottom-most window,
- * Window C is the top-most window and Window B is in the middle.
- */
- tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_NOKEY);
- tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_1WIN);
-
- switch (plane->index) {
- case 0:
- tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_2WIN_X);
- tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_2WIN_Y);
- tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_3WIN_XY);
- break;
-
- case 1:
- tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_2WIN_X);
- tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_2WIN_Y);
- tegra_plane_writel(plane, 0x000000, DC_WIN_BLEND_3WIN_XY);
- break;
-
- case 2:
- tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_2WIN_X);
- tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_2WIN_Y);
- tegra_plane_writel(plane, 0xffff00, DC_WIN_BLEND_3WIN_XY);
- break;
- }
+ if (dc->soc->supports_blending)
+ tegra_plane_setup_blending(plane, window);
+ else
+ tegra_plane_setup_blending_legacy(plane);
}
static const u32 tegra20_primary_formats[] = {
window.bottom_up = tegra_fb_is_bottom_up(fb);
/* copy from state */
+ window.zpos = plane->state->normalized_zpos;
window.tiling = state->tiling;
window.format = state->format;
window.swap = state->swap;
/* Always use window A as primary window */
plane->offset = 0xa00;
plane->index = 0;
- plane->depth = 255;
plane->dc = dc;
num_formats = dc->soc->num_primary_formats;
drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs);
+ if (dc->soc->supports_blending)
+ drm_plane_create_zpos_property(&plane->base, 0, 0, 255);
+
return &plane->base;
}
plane->offset = 0xa00 + 0x200 * index;
plane->index = index;
- plane->depth = 0;
plane->dc = dc;
num_formats = dc->soc->num_overlay_formats;
drm_plane_helper_add(&plane->base, &tegra_plane_helper_funcs);
+ if (dc->soc->supports_blending)
+ drm_plane_create_zpos_property(&plane->base, 0, 0, 255);
+
return &plane->base;
}
.supports_interlacing = false,
.supports_cursor = false,
.supports_block_linear = false,
+ .supports_blending = false,
.pitch_align = 8,
.has_powergate = false,
.broken_reset = true,
.supports_interlacing = false,
.supports_cursor = false,
.supports_block_linear = false,
+ .supports_blending = false,
.pitch_align = 8,
.has_powergate = false,
.broken_reset = false,
.supports_interlacing = false,
.supports_cursor = false,
.supports_block_linear = false,
+ .supports_blending = false,
.pitch_align = 64,
.has_powergate = true,
.broken_reset = false,
.supports_interlacing = true,
.supports_cursor = true,
.supports_block_linear = true,
+ .supports_blending = true,
.pitch_align = 64,
.has_powergate = true,
.broken_reset = false,
.supports_interlacing = true,
.supports_cursor = true,
.supports_block_linear = true,
+ .supports_blending = true,
.pitch_align = 64,
.has_powergate = true,
.broken_reset = false,
.supports_interlacing = true,
.supports_cursor = true,
.supports_block_linear = true,
+ .supports_blending = true,
.pitch_align = 64,
.has_powergate = false,
.broken_reset = false,