]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Fix overlay colorkey for 30bpp and 8bpp
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 28 Oct 2019 11:30:33 +0000 (13:30 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 15 May 2020 17:08:56 +0000 (20:08 +0300)
As with the video sprites the colorkey is always specified
as 8bpc. For 10bpc primary plane formats we just ignore the
two lsbs of each component. For C8 we'll replicate the same
key to each chanel, which is what the hardware wants.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191028113036.27553-3-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/display/intel_overlay.c

index 66711e62fa71a006544e98c51da0bc901a9ccdfd..3a69ab159dd744ac061ecce1404be42df7817666 100644 (file)
 #define CLK_RGB24_MASK         0x0
 #define CLK_RGB16_MASK         0x070307
 #define CLK_RGB15_MASK         0x070707
-#define CLK_RGB8I_MASK         0xffffff
 
+#define RGB30_TO_COLORKEY(c) \
+       (((c & 0x3FC00000) >> 6) | ((c & 0x000FF000) >> 4) | ((c & 0x000003FC) >> 2))
 #define RGB16_TO_COLORKEY(c) \
        (((c & 0xF800) << 8) | ((c & 0x07E0) << 5) | ((c & 0x001F) << 3))
 #define RGB15_TO_COLORKEY(c) \
        (((c & 0x7c00) << 9) | ((c & 0x03E0) << 6) | ((c & 0x001F) << 3))
+#define RGB8I_TO_COLORKEY(c) \
+       (((c & 0xFF) << 16) | ((c & 0XFF) << 8) | ((c & 0xFF) << 0))
 
 /* overlay flip addr flag */
 #define OFC_UPDATE             0x1
@@ -682,8 +685,8 @@ static void update_colorkey(struct intel_overlay *overlay,
 
        switch (format) {
        case DRM_FORMAT_C8:
-               key = 0;
-               flags |= CLK_RGB8I_MASK;
+               key = RGB8I_TO_COLORKEY(key);
+               flags |= CLK_RGB24_MASK;
                break;
        case DRM_FORMAT_XRGB1555:
                key = RGB15_TO_COLORKEY(key);
@@ -693,6 +696,11 @@ static void update_colorkey(struct intel_overlay *overlay,
                key = RGB16_TO_COLORKEY(key);
                flags |= CLK_RGB16_MASK;
                break;
+       case DRM_FORMAT_XRGB2101010:
+       case DRM_FORMAT_XBGR2101010:
+               key = RGB30_TO_COLORKEY(key);
+               flags |= CLK_RGB24_MASK;
+               break;
        default:
                flags |= CLK_RGB24_MASK;
                break;