From: Gustavo Padovan <[email protected]>

Change the switch to use the pixel_format instead of bpp to figure out
if we need to enable or disable the layer blending.

Signed-off-by: Gustavo Padovan <[email protected]>
---
 drivers/gpu/drm/exynos/exynos_mixer.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c 
b/drivers/gpu/drm/exynos/exynos_mixer.c
index 7aff88f..0c54098 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -529,7 +529,7 @@ static void mixer_graph_buffer(struct mixer_context *ctx, 
int win)
        unsigned int x_ratio, y_ratio;
        unsigned int src_x_offset, src_y_offset, dst_x_offset, dst_y_offset;
        dma_addr_t dma_addr;
-       unsigned int fmt;
+       unsigned int fmt, blend;
        u32 val;
 
        win_data = &ctx->win_data[win];
@@ -539,15 +539,26 @@ static void mixer_graph_buffer(struct mixer_context *ctx, 
int win)
        #define ARGB4444 6
        #define ARGB8888 7
 
-       switch (win_data->bpp) {
-       case 16:
+       switch (win_data->pixel_format) {
+       case DRM_FORMAT_ARGB4444:
                fmt = ARGB4444;
+               blend = 1;
                break;
-       case 32:
+
+       case DRM_FORMAT_ARGB8888:
+               fmt = ARGB8888;
+               blend = 1;
+               break;
+
+       case DRM_FORMAT_XRGB8888:
                fmt = ARGB8888;
+               blend = 0;
                break;
+
        default:
                fmt = ARGB8888;
+               blend = 0;
+               break;
        }
 
        if (win_data->crtc_width != win_data->src_width ||
@@ -586,6 +597,16 @@ static void mixer_graph_buffer(struct mixer_context *ctx, 
int win)
        mixer_reg_write(res, MXR_GRAPHIC_SPAN(win),
                        win_data->fb_pitch / (win_data->bpp >> 3));
 
+       if (blend) {
+               val = MXR_GRP_CFG_BLEND_PRE_MUL;
+               val |= MXR_GRP_CFG_PIXEL_BLEND_EN;
+       } else {
+               val = 0;
+       }
+       mixer_reg_writemask(res, MXR_GRAPHIC_CFG(win), val,
+                           MXR_GRP_CFG_BLEND_PRE_MUL
+                           | MXR_GRP_CFG_PIXEL_BLEND_EN);
+
        /* setup display size */
        if (ctx->mxr_ver == MXR_VER_128_0_0_184 &&
                win == MIXER_DEFAULT_WIN) {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to