]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/tegra: dc: Support background color
authorThierry Reding <treding@nvidia.com>
Mon, 13 Nov 2017 10:20:48 +0000 (11:20 +0100)
committerThierry Reding <treding@nvidia.com>
Wed, 13 Dec 2017 12:42:09 +0000 (13:42 +0100)
Starting with Tegra124, the interface to set the background color (the
value generated for pixels that are not sourced from any window) is via
a different register. Earlier generations called this the border color.
Reverse the feature flag and assume that IP revisions that don't have
support for background color will support border color instead.

Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/dc.c
drivers/gpu/drm/tegra/dc.h

index 29777604df392032429126a6af6727b4ccf3ed65..6cee248601a97243737fce8e7b7ffa742fd497f7 100644 (file)
@@ -1572,7 +1572,9 @@ static void tegra_crtc_atomic_enable(struct drm_crtc *crtc,
                WIN_A_OF_INT | WIN_B_OF_INT | WIN_C_OF_INT;
        tegra_dc_writel(dc, value, DC_CMD_INT_MASK);
 
-       if (dc->soc->supports_border_color)
+       if (dc->soc->supports_background_color)
+               tegra_dc_writel(dc, 0, DC_DISP_BLEND_BACKGROUND_COLOR);
+       else
                tegra_dc_writel(dc, 0, DC_DISP_BORDER_COLOR);
 
        /* apply PLL and pixel clock changes */
@@ -1835,7 +1837,7 @@ static const struct host1x_client_ops dc_client_ops = {
 };
 
 static const struct tegra_dc_soc_info tegra20_dc_soc_info = {
-       .supports_border_color = true,
+       .supports_background_color = false,
        .supports_interlacing = false,
        .supports_cursor = false,
        .supports_block_linear = false,
@@ -1845,7 +1847,7 @@ static const struct tegra_dc_soc_info tegra20_dc_soc_info = {
 };
 
 static const struct tegra_dc_soc_info tegra30_dc_soc_info = {
-       .supports_border_color = true,
+       .supports_background_color = false,
        .supports_interlacing = false,
        .supports_cursor = false,
        .supports_block_linear = false,
@@ -1855,7 +1857,7 @@ static const struct tegra_dc_soc_info tegra30_dc_soc_info = {
 };
 
 static const struct tegra_dc_soc_info tegra114_dc_soc_info = {
-       .supports_border_color = true,
+       .supports_background_color = false,
        .supports_interlacing = false,
        .supports_cursor = false,
        .supports_block_linear = false,
@@ -1865,7 +1867,7 @@ static const struct tegra_dc_soc_info tegra114_dc_soc_info = {
 };
 
 static const struct tegra_dc_soc_info tegra124_dc_soc_info = {
-       .supports_border_color = false,
+       .supports_background_color = true,
        .supports_interlacing = true,
        .supports_cursor = true,
        .supports_block_linear = true,
@@ -1875,7 +1877,7 @@ static const struct tegra_dc_soc_info tegra124_dc_soc_info = {
 };
 
 static const struct tegra_dc_soc_info tegra210_dc_soc_info = {
-       .supports_border_color = false,
+       .supports_background_color = true,
        .supports_interlacing = true,
        .supports_cursor = true,
        .supports_block_linear = true,
index 032c734dd4703dc5e4364177b4fb9be7a1a6e67d..571a6c78619faa04585da46fa1f6afc503a76a70 100644 (file)
@@ -26,7 +26,7 @@ struct tegra_dc_stats {
 };
 
 struct tegra_dc_soc_info {
-       bool supports_border_color;
+       bool supports_background_color;
        bool supports_interlacing;
        bool supports_cursor;
        bool supports_block_linear;
@@ -447,6 +447,12 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc);
 #define DC_DISP_SD_HW_K_VALUES                 0x4dd
 #define DC_DISP_SD_MAN_K_VALUES                        0x4de
 
+#define DC_DISP_BLEND_BACKGROUND_COLOR         0x4e4
+#define  BACKGROUND_COLOR_ALPHA(x) (((x) & 0xff) << 24)
+#define  BACKGROUND_COLOR_BLUE(x)  (((x) & 0xff) << 16)
+#define  BACKGROUND_COLOR_GREEN(x) (((x) & 0xff) << 8)
+#define  BACKGROUND_COLOR_RED(x)   (((x) & 0xff) << 0)
+
 #define DC_DISP_INTERLACE_CONTROL              0x4e5
 #define  INTERLACE_STATUS (1 << 2)
 #define  INTERLACE_START  (1 << 1)