Path: blob/master/drivers/gpu/drm/armada/armada_overlay.c
26481 views
// SPDX-License-Identifier: GPL-2.0-only1/*2* Copyright (C) 2012 Russell King3* Rewritten from the dovefb driver, and Armada510 manuals.4*/56#include <linux/bitfield.h>78#include <drm/armada_drm.h>9#include <drm/drm_atomic.h>10#include <drm/drm_atomic_helper.h>11#include <drm/drm_atomic_uapi.h>12#include <drm/drm_fourcc.h>13#include <drm/drm_plane_helper.h>1415#include "armada_crtc.h"16#include "armada_drm.h"17#include "armada_fb.h"18#include "armada_gem.h"19#include "armada_hw.h"20#include "armada_ioctlP.h"21#include "armada_plane.h"22#include "armada_trace.h"2324#define DEFAULT_BRIGHTNESS 025#define DEFAULT_CONTRAST 0x400026#define DEFAULT_SATURATION 0x400027#define DEFAULT_ENCODING DRM_COLOR_YCBCR_BT6012829struct armada_overlay_state {30struct armada_plane_state base;31u32 colorkey_yr;32u32 colorkey_ug;33u32 colorkey_vb;34u32 colorkey_mode;35u32 colorkey_enable;36s16 brightness;37u16 contrast;38u16 saturation;39};40#define drm_to_overlay_state(s) \41container_of(s, struct armada_overlay_state, base.base)4243static inline u32 armada_spu_contrast(struct drm_plane_state *state)44{45return drm_to_overlay_state(state)->brightness << 16 |46drm_to_overlay_state(state)->contrast;47}4849static inline u32 armada_spu_saturation(struct drm_plane_state *state)50{51/* Docs say 15:0, but it seems to actually be 31:16 on Armada 510 */52return drm_to_overlay_state(state)->saturation << 16;53}5455static inline u32 armada_csc(struct drm_plane_state *state)56{57/*58* The CFG_CSC_RGB_* settings control the output of the colour space59* converter, setting the range of output values it produces. Since60* we will be blending with the full-range graphics, we need to61* produce full-range RGB output from the conversion.62*/63return CFG_CSC_RGB_COMPUTER |64(state->color_encoding == DRM_COLOR_YCBCR_BT709 ?65CFG_CSC_YUV_CCIR709 : CFG_CSC_YUV_CCIR601);66}6768/* === Plane support === */69static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane,70struct drm_atomic_state *state)71{72struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,73plane);74struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,75plane);76struct armada_crtc *dcrtc;77struct armada_regs *regs;78unsigned int idx;79u32 cfg, cfg_mask, val;8081DRM_DEBUG_KMS("[PLANE:%d:%s]\n", plane->base.id, plane->name);8283if (!new_state->fb || WARN_ON(!new_state->crtc))84return;8586DRM_DEBUG_KMS("[PLANE:%d:%s] is on [CRTC:%d:%s] with [FB:%d] visible %u->%u\n",87plane->base.id, plane->name,88new_state->crtc->base.id, new_state->crtc->name,89new_state->fb->base.id,90old_state->visible, new_state->visible);9192dcrtc = drm_to_armada_crtc(new_state->crtc);93regs = dcrtc->regs + dcrtc->regs_idx;9495idx = 0;96if (!old_state->visible && new_state->visible)97armada_reg_queue_mod(regs, idx,980, CFG_PDWN16x66 | CFG_PDWN32x66,99LCD_SPU_SRAM_PARA1);100val = armada_src_hw(new_state);101if (armada_src_hw(old_state) != val)102armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_HPXL_VLN);103val = armada_dst_yx(new_state);104if (armada_dst_yx(old_state) != val)105armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_OVSA_HPXL_VLN);106val = armada_dst_hw(new_state);107if (armada_dst_hw(old_state) != val)108armada_reg_queue_set(regs, idx, val, LCD_SPU_DZM_HPXL_VLN);109/* FIXME: overlay on an interlaced display */110if (old_state->src.x1 != new_state->src.x1 ||111old_state->src.y1 != new_state->src.y1 ||112old_state->fb != new_state->fb ||113new_state->crtc->state->mode_changed) {114const struct drm_format_info *format;115u16 src_x;116117armada_reg_queue_set(regs, idx, armada_addr(new_state, 0, 0),118LCD_SPU_DMA_START_ADDR_Y0);119armada_reg_queue_set(regs, idx, armada_addr(new_state, 0, 1),120LCD_SPU_DMA_START_ADDR_U0);121armada_reg_queue_set(regs, idx, armada_addr(new_state, 0, 2),122LCD_SPU_DMA_START_ADDR_V0);123armada_reg_queue_set(regs, idx, armada_addr(new_state, 1, 0),124LCD_SPU_DMA_START_ADDR_Y1);125armada_reg_queue_set(regs, idx, armada_addr(new_state, 1, 1),126LCD_SPU_DMA_START_ADDR_U1);127armada_reg_queue_set(regs, idx, armada_addr(new_state, 1, 2),128LCD_SPU_DMA_START_ADDR_V1);129130val = armada_pitch(new_state, 0) << 16 | armada_pitch(new_state,1310);132armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_PITCH_YC);133val = armada_pitch(new_state, 1) << 16 | armada_pitch(new_state,1342);135armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_PITCH_UV);136137cfg = CFG_DMA_FMT(drm_fb_to_armada_fb(new_state->fb)->fmt) |138CFG_DMA_MOD(drm_fb_to_armada_fb(new_state->fb)->mod) |139CFG_CBSH_ENA;140if (new_state->visible)141cfg |= CFG_DMA_ENA;142143/*144* Shifting a YUV packed format image by one pixel causes the145* U/V planes to swap. Compensate for it by also toggling146* the UV swap.147*/148format = new_state->fb->format;149src_x = new_state->src.x1 >> 16;150if (format->num_planes == 1 && src_x & (format->hsub - 1))151cfg ^= CFG_DMA_MOD(CFG_SWAPUV);152if (to_armada_plane_state(new_state)->interlace)153cfg |= CFG_DMA_FTOGGLE;154cfg_mask = CFG_CBSH_ENA | CFG_DMAFORMAT |155CFG_DMA_MOD(CFG_SWAPRB | CFG_SWAPUV |156CFG_SWAPYU | CFG_YUV2RGB) |157CFG_DMA_FTOGGLE | CFG_DMA_TSTMODE |158CFG_DMA_ENA;159} else if (old_state->visible != new_state->visible) {160cfg = new_state->visible ? CFG_DMA_ENA : 0;161cfg_mask = CFG_DMA_ENA;162} else {163cfg = cfg_mask = 0;164}165if (drm_rect_width(&old_state->src) != drm_rect_width(&new_state->src) ||166drm_rect_width(&old_state->dst) != drm_rect_width(&new_state->dst)) {167cfg_mask |= CFG_DMA_HSMOOTH;168if (drm_rect_width(&new_state->src) >> 16 !=169drm_rect_width(&new_state->dst))170cfg |= CFG_DMA_HSMOOTH;171}172173if (cfg_mask)174armada_reg_queue_mod(regs, idx, cfg, cfg_mask,175LCD_SPU_DMA_CTRL0);176177val = armada_spu_contrast(new_state);178if ((!old_state->visible && new_state->visible) ||179armada_spu_contrast(old_state) != val)180armada_reg_queue_set(regs, idx, val, LCD_SPU_CONTRAST);181val = armada_spu_saturation(new_state);182if ((!old_state->visible && new_state->visible) ||183armada_spu_saturation(old_state) != val)184armada_reg_queue_set(regs, idx, val, LCD_SPU_SATURATION);185if (!old_state->visible && new_state->visible)186armada_reg_queue_set(regs, idx, 0x00002000, LCD_SPU_CBSH_HUE);187val = armada_csc(new_state);188if ((!old_state->visible && new_state->visible) ||189armada_csc(old_state) != val)190armada_reg_queue_mod(regs, idx, val, CFG_CSC_MASK,191LCD_SPU_IOPAD_CONTROL);192val = drm_to_overlay_state(new_state)->colorkey_yr;193if ((!old_state->visible && new_state->visible) ||194drm_to_overlay_state(old_state)->colorkey_yr != val)195armada_reg_queue_set(regs, idx, val, LCD_SPU_COLORKEY_Y);196val = drm_to_overlay_state(new_state)->colorkey_ug;197if ((!old_state->visible && new_state->visible) ||198drm_to_overlay_state(old_state)->colorkey_ug != val)199armada_reg_queue_set(regs, idx, val, LCD_SPU_COLORKEY_U);200val = drm_to_overlay_state(new_state)->colorkey_vb;201if ((!old_state->visible && new_state->visible) ||202drm_to_overlay_state(old_state)->colorkey_vb != val)203armada_reg_queue_set(regs, idx, val, LCD_SPU_COLORKEY_V);204val = drm_to_overlay_state(new_state)->colorkey_mode;205if ((!old_state->visible && new_state->visible) ||206drm_to_overlay_state(old_state)->colorkey_mode != val)207armada_reg_queue_mod(regs, idx, val, CFG_CKMODE_MASK |208CFG_ALPHAM_MASK | CFG_ALPHA_MASK,209LCD_SPU_DMA_CTRL1);210val = drm_to_overlay_state(new_state)->colorkey_enable;211if (((!old_state->visible && new_state->visible) ||212drm_to_overlay_state(old_state)->colorkey_enable != val) &&213dcrtc->variant->has_spu_adv_reg)214armada_reg_queue_mod(regs, idx, val, ADV_GRACOLORKEY |215ADV_VIDCOLORKEY, LCD_SPU_ADV_REG);216217dcrtc->regs_idx += idx;218}219220static void armada_drm_overlay_plane_atomic_disable(struct drm_plane *plane,221struct drm_atomic_state *state)222{223struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,224plane);225struct armada_crtc *dcrtc;226struct armada_regs *regs;227unsigned int idx = 0;228229DRM_DEBUG_KMS("[PLANE:%d:%s]\n", plane->base.id, plane->name);230231if (!old_state->crtc)232return;233234DRM_DEBUG_KMS("[PLANE:%d:%s] was on [CRTC:%d:%s] with [FB:%d]\n",235plane->base.id, plane->name,236old_state->crtc->base.id, old_state->crtc->name,237old_state->fb->base.id);238239dcrtc = drm_to_armada_crtc(old_state->crtc);240regs = dcrtc->regs + dcrtc->regs_idx;241242/* Disable plane and power down the YUV FIFOs */243armada_reg_queue_mod(regs, idx, 0, CFG_DMA_ENA, LCD_SPU_DMA_CTRL0);244armada_reg_queue_mod(regs, idx, CFG_PDWN16x66 | CFG_PDWN32x66, 0,245LCD_SPU_SRAM_PARA1);246247dcrtc->regs_idx += idx;248}249250static const struct drm_plane_helper_funcs armada_overlay_plane_helper_funcs = {251.atomic_check = armada_drm_plane_atomic_check,252.atomic_update = armada_drm_overlay_plane_atomic_update,253.atomic_disable = armada_drm_overlay_plane_atomic_disable,254};255256static int257armada_overlay_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,258struct drm_framebuffer *fb,259int crtc_x, int crtc_y, unsigned crtc_w, unsigned crtc_h,260uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h,261struct drm_modeset_acquire_ctx *ctx)262{263struct drm_atomic_state *state;264struct drm_plane_state *plane_state;265int ret = 0;266267trace_armada_ovl_plane_update(plane, crtc, fb,268crtc_x, crtc_y, crtc_w, crtc_h,269src_x, src_y, src_w, src_h);270271state = drm_atomic_state_alloc(plane->dev);272if (!state)273return -ENOMEM;274275state->acquire_ctx = ctx;276plane_state = drm_atomic_get_plane_state(state, plane);277if (IS_ERR(plane_state)) {278ret = PTR_ERR(plane_state);279goto fail;280}281282ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);283if (ret != 0)284goto fail;285286drm_atomic_set_fb_for_plane(plane_state, fb);287plane_state->crtc_x = crtc_x;288plane_state->crtc_y = crtc_y;289plane_state->crtc_h = crtc_h;290plane_state->crtc_w = crtc_w;291plane_state->src_x = src_x;292plane_state->src_y = src_y;293plane_state->src_h = src_h;294plane_state->src_w = src_w;295296ret = drm_atomic_nonblocking_commit(state);297fail:298drm_atomic_state_put(state);299return ret;300}301302static void armada_overlay_reset(struct drm_plane *plane)303{304struct armada_overlay_state *state;305306if (plane->state)307__drm_atomic_helper_plane_destroy_state(plane->state);308kfree(plane->state);309plane->state = NULL;310311state = kzalloc(sizeof(*state), GFP_KERNEL);312if (state) {313state->colorkey_yr = 0xfefefe00;314state->colorkey_ug = 0x01010100;315state->colorkey_vb = 0x01010100;316state->colorkey_mode = CFG_CKMODE(CKMODE_RGB) |317CFG_ALPHAM_GRA | CFG_ALPHA(0);318state->colorkey_enable = ADV_GRACOLORKEY;319state->brightness = DEFAULT_BRIGHTNESS;320state->contrast = DEFAULT_CONTRAST;321state->saturation = DEFAULT_SATURATION;322__drm_atomic_helper_plane_reset(plane, &state->base.base);323state->base.base.color_encoding = DEFAULT_ENCODING;324state->base.base.color_range = DRM_COLOR_YCBCR_LIMITED_RANGE;325}326}327328static struct drm_plane_state *329armada_overlay_duplicate_state(struct drm_plane *plane)330{331struct armada_overlay_state *state;332333if (WARN_ON(!plane->state))334return NULL;335336state = kmemdup(plane->state, sizeof(*state), GFP_KERNEL);337if (state)338__drm_atomic_helper_plane_duplicate_state(plane,339&state->base.base);340return &state->base.base;341}342343static int armada_overlay_set_property(struct drm_plane *plane,344struct drm_plane_state *state, struct drm_property *property,345uint64_t val)346{347struct armada_private *priv = drm_to_armada_dev(plane->dev);348349#define K2R(val) (((val) >> 0) & 0xff)350#define K2G(val) (((val) >> 8) & 0xff)351#define K2B(val) (((val) >> 16) & 0xff)352if (property == priv->colorkey_prop) {353#define CCC(v) ((v) << 24 | (v) << 16 | (v) << 8)354drm_to_overlay_state(state)->colorkey_yr = CCC(K2R(val));355drm_to_overlay_state(state)->colorkey_ug = CCC(K2G(val));356drm_to_overlay_state(state)->colorkey_vb = CCC(K2B(val));357#undef CCC358} else if (property == priv->colorkey_min_prop) {359drm_to_overlay_state(state)->colorkey_yr &= ~0x00ff0000;360drm_to_overlay_state(state)->colorkey_yr |= K2R(val) << 16;361drm_to_overlay_state(state)->colorkey_ug &= ~0x00ff0000;362drm_to_overlay_state(state)->colorkey_ug |= K2G(val) << 16;363drm_to_overlay_state(state)->colorkey_vb &= ~0x00ff0000;364drm_to_overlay_state(state)->colorkey_vb |= K2B(val) << 16;365} else if (property == priv->colorkey_max_prop) {366drm_to_overlay_state(state)->colorkey_yr &= ~0xff000000;367drm_to_overlay_state(state)->colorkey_yr |= K2R(val) << 24;368drm_to_overlay_state(state)->colorkey_ug &= ~0xff000000;369drm_to_overlay_state(state)->colorkey_ug |= K2G(val) << 24;370drm_to_overlay_state(state)->colorkey_vb &= ~0xff000000;371drm_to_overlay_state(state)->colorkey_vb |= K2B(val) << 24;372} else if (property == priv->colorkey_val_prop) {373drm_to_overlay_state(state)->colorkey_yr &= ~0x0000ff00;374drm_to_overlay_state(state)->colorkey_yr |= K2R(val) << 8;375drm_to_overlay_state(state)->colorkey_ug &= ~0x0000ff00;376drm_to_overlay_state(state)->colorkey_ug |= K2G(val) << 8;377drm_to_overlay_state(state)->colorkey_vb &= ~0x0000ff00;378drm_to_overlay_state(state)->colorkey_vb |= K2B(val) << 8;379} else if (property == priv->colorkey_alpha_prop) {380drm_to_overlay_state(state)->colorkey_yr &= ~0x000000ff;381drm_to_overlay_state(state)->colorkey_yr |= K2R(val);382drm_to_overlay_state(state)->colorkey_ug &= ~0x000000ff;383drm_to_overlay_state(state)->colorkey_ug |= K2G(val);384drm_to_overlay_state(state)->colorkey_vb &= ~0x000000ff;385drm_to_overlay_state(state)->colorkey_vb |= K2B(val);386} else if (property == priv->colorkey_mode_prop) {387if (val == CKMODE_DISABLE) {388drm_to_overlay_state(state)->colorkey_mode =389CFG_CKMODE(CKMODE_DISABLE) |390CFG_ALPHAM_CFG | CFG_ALPHA(255);391drm_to_overlay_state(state)->colorkey_enable = 0;392} else {393drm_to_overlay_state(state)->colorkey_mode =394CFG_CKMODE(val) |395CFG_ALPHAM_GRA | CFG_ALPHA(0);396drm_to_overlay_state(state)->colorkey_enable =397ADV_GRACOLORKEY;398}399} else if (property == priv->brightness_prop) {400drm_to_overlay_state(state)->brightness = val - 256;401} else if (property == priv->contrast_prop) {402drm_to_overlay_state(state)->contrast = val;403} else if (property == priv->saturation_prop) {404drm_to_overlay_state(state)->saturation = val;405} else {406return -EINVAL;407}408return 0;409}410411static int armada_overlay_get_property(struct drm_plane *plane,412const struct drm_plane_state *state, struct drm_property *property,413uint64_t *val)414{415struct armada_private *priv = drm_to_armada_dev(plane->dev);416417#define C2K(c,s) (((c) >> (s)) & 0xff)418#define R2BGR(r,g,b,s) (C2K(r,s) << 0 | C2K(g,s) << 8 | C2K(b,s) << 16)419if (property == priv->colorkey_prop) {420/* Do best-efforts here for this property */421*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,422drm_to_overlay_state(state)->colorkey_ug,423drm_to_overlay_state(state)->colorkey_vb, 16);424/* If min != max, or min != val, error out */425if (*val != R2BGR(drm_to_overlay_state(state)->colorkey_yr,426drm_to_overlay_state(state)->colorkey_ug,427drm_to_overlay_state(state)->colorkey_vb, 24) ||428*val != R2BGR(drm_to_overlay_state(state)->colorkey_yr,429drm_to_overlay_state(state)->colorkey_ug,430drm_to_overlay_state(state)->colorkey_vb, 8))431return -EINVAL;432} else if (property == priv->colorkey_min_prop) {433*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,434drm_to_overlay_state(state)->colorkey_ug,435drm_to_overlay_state(state)->colorkey_vb, 16);436} else if (property == priv->colorkey_max_prop) {437*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,438drm_to_overlay_state(state)->colorkey_ug,439drm_to_overlay_state(state)->colorkey_vb, 24);440} else if (property == priv->colorkey_val_prop) {441*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,442drm_to_overlay_state(state)->colorkey_ug,443drm_to_overlay_state(state)->colorkey_vb, 8);444} else if (property == priv->colorkey_alpha_prop) {445*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,446drm_to_overlay_state(state)->colorkey_ug,447drm_to_overlay_state(state)->colorkey_vb, 0);448} else if (property == priv->colorkey_mode_prop) {449*val = FIELD_GET(CFG_CKMODE_MASK,450drm_to_overlay_state(state)->colorkey_mode);451} else if (property == priv->brightness_prop) {452*val = drm_to_overlay_state(state)->brightness + 256;453} else if (property == priv->contrast_prop) {454*val = drm_to_overlay_state(state)->contrast;455} else if (property == priv->saturation_prop) {456*val = drm_to_overlay_state(state)->saturation;457} else {458return -EINVAL;459}460return 0;461}462463static const struct drm_plane_funcs armada_ovl_plane_funcs = {464.update_plane = armada_overlay_plane_update,465.disable_plane = drm_atomic_helper_disable_plane,466.destroy = drm_plane_helper_destroy,467.reset = armada_overlay_reset,468.atomic_duplicate_state = armada_overlay_duplicate_state,469.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,470.atomic_set_property = armada_overlay_set_property,471.atomic_get_property = armada_overlay_get_property,472};473474static const uint32_t armada_ovl_formats[] = {475DRM_FORMAT_UYVY,476DRM_FORMAT_YUYV,477DRM_FORMAT_YUV420,478DRM_FORMAT_YVU420,479DRM_FORMAT_YUV422,480DRM_FORMAT_YVU422,481DRM_FORMAT_VYUY,482DRM_FORMAT_YVYU,483DRM_FORMAT_ARGB8888,484DRM_FORMAT_ABGR8888,485DRM_FORMAT_XRGB8888,486DRM_FORMAT_XBGR8888,487DRM_FORMAT_RGB888,488DRM_FORMAT_BGR888,489DRM_FORMAT_ARGB1555,490DRM_FORMAT_ABGR1555,491DRM_FORMAT_RGB565,492DRM_FORMAT_BGR565,493};494495static const struct drm_prop_enum_list armada_drm_colorkey_enum_list[] = {496{ CKMODE_DISABLE, "disabled" },497{ CKMODE_Y, "Y component" },498{ CKMODE_U, "U component" },499{ CKMODE_V, "V component" },500{ CKMODE_RGB, "RGB" },501{ CKMODE_R, "R component" },502{ CKMODE_G, "G component" },503{ CKMODE_B, "B component" },504};505506static int armada_overlay_create_properties(struct drm_device *dev)507{508struct armada_private *priv = drm_to_armada_dev(dev);509510if (priv->colorkey_prop)511return 0;512513priv->colorkey_prop = drm_property_create_range(dev, 0,514"colorkey", 0, 0xffffff);515priv->colorkey_min_prop = drm_property_create_range(dev, 0,516"colorkey_min", 0, 0xffffff);517priv->colorkey_max_prop = drm_property_create_range(dev, 0,518"colorkey_max", 0, 0xffffff);519priv->colorkey_val_prop = drm_property_create_range(dev, 0,520"colorkey_val", 0, 0xffffff);521priv->colorkey_alpha_prop = drm_property_create_range(dev, 0,522"colorkey_alpha", 0, 0xffffff);523priv->colorkey_mode_prop = drm_property_create_enum(dev, 0,524"colorkey_mode",525armada_drm_colorkey_enum_list,526ARRAY_SIZE(armada_drm_colorkey_enum_list));527priv->brightness_prop = drm_property_create_range(dev, 0,528"brightness", 0, 256 + 255);529priv->contrast_prop = drm_property_create_range(dev, 0,530"contrast", 0, 0x7fff);531priv->saturation_prop = drm_property_create_range(dev, 0,532"saturation", 0, 0x7fff);533534if (!priv->colorkey_prop)535return -ENOMEM;536537return 0;538}539540int armada_overlay_plane_create(struct drm_device *dev, unsigned long crtcs)541{542struct armada_private *priv = drm_to_armada_dev(dev);543struct drm_mode_object *mobj;544struct drm_plane *overlay;545int ret;546547ret = armada_overlay_create_properties(dev);548if (ret)549return ret;550551overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);552if (!overlay)553return -ENOMEM;554555drm_plane_helper_add(overlay, &armada_overlay_plane_helper_funcs);556557ret = drm_universal_plane_init(dev, overlay, crtcs,558&armada_ovl_plane_funcs,559armada_ovl_formats,560ARRAY_SIZE(armada_ovl_formats),561NULL,562DRM_PLANE_TYPE_OVERLAY, NULL);563if (ret) {564kfree(overlay);565return ret;566}567568mobj = &overlay->base;569drm_object_attach_property(mobj, priv->colorkey_prop,5700x0101fe);571drm_object_attach_property(mobj, priv->colorkey_min_prop,5720x0101fe);573drm_object_attach_property(mobj, priv->colorkey_max_prop,5740x0101fe);575drm_object_attach_property(mobj, priv->colorkey_val_prop,5760x0101fe);577drm_object_attach_property(mobj, priv->colorkey_alpha_prop,5780x000000);579drm_object_attach_property(mobj, priv->colorkey_mode_prop,580CKMODE_RGB);581drm_object_attach_property(mobj, priv->brightness_prop,582256 + DEFAULT_BRIGHTNESS);583drm_object_attach_property(mobj, priv->contrast_prop,584DEFAULT_CONTRAST);585drm_object_attach_property(mobj, priv->saturation_prop,586DEFAULT_SATURATION);587588ret = drm_plane_create_color_properties(overlay,589BIT(DRM_COLOR_YCBCR_BT601) |590BIT(DRM_COLOR_YCBCR_BT709),591BIT(DRM_COLOR_YCBCR_LIMITED_RANGE),592DEFAULT_ENCODING,593DRM_COLOR_YCBCR_LIMITED_RANGE);594595return ret;596}597598599