Path: blob/master/drivers/gpu/drm/armada/armada_overlay.c
50620 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>14#include <drm/drm_print.h>1516#include "armada_crtc.h"17#include "armada_drm.h"18#include "armada_fb.h"19#include "armada_gem.h"20#include "armada_hw.h"21#include "armada_ioctlP.h"22#include "armada_plane.h"23#include "armada_trace.h"2425#define DEFAULT_BRIGHTNESS 026#define DEFAULT_CONTRAST 0x400027#define DEFAULT_SATURATION 0x400028#define DEFAULT_ENCODING DRM_COLOR_YCBCR_BT6012930struct armada_overlay_state {31struct armada_plane_state base;32u32 colorkey_yr;33u32 colorkey_ug;34u32 colorkey_vb;35u32 colorkey_mode;36u32 colorkey_enable;37s16 brightness;38u16 contrast;39u16 saturation;40};41#define drm_to_overlay_state(s) \42container_of(s, struct armada_overlay_state, base.base)4344static inline u32 armada_spu_contrast(struct drm_plane_state *state)45{46return drm_to_overlay_state(state)->brightness << 16 |47drm_to_overlay_state(state)->contrast;48}4950static inline u32 armada_spu_saturation(struct drm_plane_state *state)51{52/* Docs say 15:0, but it seems to actually be 31:16 on Armada 510 */53return drm_to_overlay_state(state)->saturation << 16;54}5556static inline u32 armada_csc(struct drm_plane_state *state)57{58/*59* The CFG_CSC_RGB_* settings control the output of the colour space60* converter, setting the range of output values it produces. Since61* we will be blending with the full-range graphics, we need to62* produce full-range RGB output from the conversion.63*/64return CFG_CSC_RGB_COMPUTER |65(state->color_encoding == DRM_COLOR_YCBCR_BT709 ?66CFG_CSC_YUV_CCIR709 : CFG_CSC_YUV_CCIR601);67}6869/* === Plane support === */70static void armada_drm_overlay_plane_atomic_update(struct drm_plane *plane,71struct drm_atomic_state *state)72{73struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,74plane);75struct drm_plane_state *new_state = drm_atomic_get_new_plane_state(state,76plane);77struct armada_crtc *dcrtc;78struct armada_regs *regs;79unsigned int idx;80u32 cfg, cfg_mask, val;8182DRM_DEBUG_KMS("[PLANE:%d:%s]\n", plane->base.id, plane->name);8384if (!new_state->fb || WARN_ON(!new_state->crtc))85return;8687DRM_DEBUG_KMS("[PLANE:%d:%s] is on [CRTC:%d:%s] with [FB:%d] visible %u->%u\n",88plane->base.id, plane->name,89new_state->crtc->base.id, new_state->crtc->name,90new_state->fb->base.id,91old_state->visible, new_state->visible);9293dcrtc = drm_to_armada_crtc(new_state->crtc);94regs = dcrtc->regs + dcrtc->regs_idx;9596idx = 0;97if (!old_state->visible && new_state->visible)98armada_reg_queue_mod(regs, idx,990, CFG_PDWN16x66 | CFG_PDWN32x66,100LCD_SPU_SRAM_PARA1);101val = armada_src_hw(new_state);102if (armada_src_hw(old_state) != val)103armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_HPXL_VLN);104val = armada_dst_yx(new_state);105if (armada_dst_yx(old_state) != val)106armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_OVSA_HPXL_VLN);107val = armada_dst_hw(new_state);108if (armada_dst_hw(old_state) != val)109armada_reg_queue_set(regs, idx, val, LCD_SPU_DZM_HPXL_VLN);110/* FIXME: overlay on an interlaced display */111if (old_state->src.x1 != new_state->src.x1 ||112old_state->src.y1 != new_state->src.y1 ||113old_state->fb != new_state->fb ||114new_state->crtc->state->mode_changed) {115const struct drm_format_info *format;116u16 src_x;117118armada_reg_queue_set(regs, idx, armada_addr(new_state, 0, 0),119LCD_SPU_DMA_START_ADDR_Y0);120armada_reg_queue_set(regs, idx, armada_addr(new_state, 0, 1),121LCD_SPU_DMA_START_ADDR_U0);122armada_reg_queue_set(regs, idx, armada_addr(new_state, 0, 2),123LCD_SPU_DMA_START_ADDR_V0);124armada_reg_queue_set(regs, idx, armada_addr(new_state, 1, 0),125LCD_SPU_DMA_START_ADDR_Y1);126armada_reg_queue_set(regs, idx, armada_addr(new_state, 1, 1),127LCD_SPU_DMA_START_ADDR_U1);128armada_reg_queue_set(regs, idx, armada_addr(new_state, 1, 2),129LCD_SPU_DMA_START_ADDR_V1);130131val = armada_pitch(new_state, 0) << 16 | armada_pitch(new_state,1320);133armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_PITCH_YC);134val = armada_pitch(new_state, 1) << 16 | armada_pitch(new_state,1352);136armada_reg_queue_set(regs, idx, val, LCD_SPU_DMA_PITCH_UV);137138cfg = CFG_DMA_FMT(drm_fb_to_armada_fb(new_state->fb)->fmt) |139CFG_DMA_MOD(drm_fb_to_armada_fb(new_state->fb)->mod) |140CFG_CBSH_ENA;141if (new_state->visible)142cfg |= CFG_DMA_ENA;143144/*145* Shifting a YUV packed format image by one pixel causes the146* U/V planes to swap. Compensate for it by also toggling147* the UV swap.148*/149format = new_state->fb->format;150src_x = new_state->src.x1 >> 16;151if (format->num_planes == 1 && src_x & (format->hsub - 1))152cfg ^= CFG_DMA_MOD(CFG_SWAPUV);153if (to_armada_plane_state(new_state)->interlace)154cfg |= CFG_DMA_FTOGGLE;155cfg_mask = CFG_CBSH_ENA | CFG_DMAFORMAT |156CFG_DMA_MOD(CFG_SWAPRB | CFG_SWAPUV |157CFG_SWAPYU | CFG_YUV2RGB) |158CFG_DMA_FTOGGLE | CFG_DMA_TSTMODE |159CFG_DMA_ENA;160} else if (old_state->visible != new_state->visible) {161cfg = new_state->visible ? CFG_DMA_ENA : 0;162cfg_mask = CFG_DMA_ENA;163} else {164cfg = cfg_mask = 0;165}166if (drm_rect_width(&old_state->src) != drm_rect_width(&new_state->src) ||167drm_rect_width(&old_state->dst) != drm_rect_width(&new_state->dst)) {168cfg_mask |= CFG_DMA_HSMOOTH;169if (drm_rect_width(&new_state->src) >> 16 !=170drm_rect_width(&new_state->dst))171cfg |= CFG_DMA_HSMOOTH;172}173174if (cfg_mask)175armada_reg_queue_mod(regs, idx, cfg, cfg_mask,176LCD_SPU_DMA_CTRL0);177178val = armada_spu_contrast(new_state);179if ((!old_state->visible && new_state->visible) ||180armada_spu_contrast(old_state) != val)181armada_reg_queue_set(regs, idx, val, LCD_SPU_CONTRAST);182val = armada_spu_saturation(new_state);183if ((!old_state->visible && new_state->visible) ||184armada_spu_saturation(old_state) != val)185armada_reg_queue_set(regs, idx, val, LCD_SPU_SATURATION);186if (!old_state->visible && new_state->visible)187armada_reg_queue_set(regs, idx, 0x00002000, LCD_SPU_CBSH_HUE);188val = armada_csc(new_state);189if ((!old_state->visible && new_state->visible) ||190armada_csc(old_state) != val)191armada_reg_queue_mod(regs, idx, val, CFG_CSC_MASK,192LCD_SPU_IOPAD_CONTROL);193val = drm_to_overlay_state(new_state)->colorkey_yr;194if ((!old_state->visible && new_state->visible) ||195drm_to_overlay_state(old_state)->colorkey_yr != val)196armada_reg_queue_set(regs, idx, val, LCD_SPU_COLORKEY_Y);197val = drm_to_overlay_state(new_state)->colorkey_ug;198if ((!old_state->visible && new_state->visible) ||199drm_to_overlay_state(old_state)->colorkey_ug != val)200armada_reg_queue_set(regs, idx, val, LCD_SPU_COLORKEY_U);201val = drm_to_overlay_state(new_state)->colorkey_vb;202if ((!old_state->visible && new_state->visible) ||203drm_to_overlay_state(old_state)->colorkey_vb != val)204armada_reg_queue_set(regs, idx, val, LCD_SPU_COLORKEY_V);205val = drm_to_overlay_state(new_state)->colorkey_mode;206if ((!old_state->visible && new_state->visible) ||207drm_to_overlay_state(old_state)->colorkey_mode != val)208armada_reg_queue_mod(regs, idx, val, CFG_CKMODE_MASK |209CFG_ALPHAM_MASK | CFG_ALPHA_MASK,210LCD_SPU_DMA_CTRL1);211val = drm_to_overlay_state(new_state)->colorkey_enable;212if (((!old_state->visible && new_state->visible) ||213drm_to_overlay_state(old_state)->colorkey_enable != val) &&214dcrtc->variant->has_spu_adv_reg)215armada_reg_queue_mod(regs, idx, val, ADV_GRACOLORKEY |216ADV_VIDCOLORKEY, LCD_SPU_ADV_REG);217218dcrtc->regs_idx += idx;219}220221static void armada_drm_overlay_plane_atomic_disable(struct drm_plane *plane,222struct drm_atomic_state *state)223{224struct drm_plane_state *old_state = drm_atomic_get_old_plane_state(state,225plane);226struct armada_crtc *dcrtc;227struct armada_regs *regs;228unsigned int idx = 0;229230DRM_DEBUG_KMS("[PLANE:%d:%s]\n", plane->base.id, plane->name);231232if (!old_state->crtc)233return;234235DRM_DEBUG_KMS("[PLANE:%d:%s] was on [CRTC:%d:%s] with [FB:%d]\n",236plane->base.id, plane->name,237old_state->crtc->base.id, old_state->crtc->name,238old_state->fb->base.id);239240dcrtc = drm_to_armada_crtc(old_state->crtc);241regs = dcrtc->regs + dcrtc->regs_idx;242243/* Disable plane and power down the YUV FIFOs */244armada_reg_queue_mod(regs, idx, 0, CFG_DMA_ENA, LCD_SPU_DMA_CTRL0);245armada_reg_queue_mod(regs, idx, CFG_PDWN16x66 | CFG_PDWN32x66, 0,246LCD_SPU_SRAM_PARA1);247248dcrtc->regs_idx += idx;249}250251static const struct drm_plane_helper_funcs armada_overlay_plane_helper_funcs = {252.atomic_check = armada_drm_plane_atomic_check,253.atomic_update = armada_drm_overlay_plane_atomic_update,254.atomic_disable = armada_drm_overlay_plane_atomic_disable,255};256257static int258armada_overlay_plane_update(struct drm_plane *plane, struct drm_crtc *crtc,259struct drm_framebuffer *fb,260int crtc_x, int crtc_y, unsigned crtc_w, unsigned crtc_h,261uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h,262struct drm_modeset_acquire_ctx *ctx)263{264struct drm_atomic_state *state;265struct drm_plane_state *plane_state;266int ret = 0;267268trace_armada_ovl_plane_update(plane, crtc, fb,269crtc_x, crtc_y, crtc_w, crtc_h,270src_x, src_y, src_w, src_h);271272state = drm_atomic_state_alloc(plane->dev);273if (!state)274return -ENOMEM;275276state->acquire_ctx = ctx;277plane_state = drm_atomic_get_plane_state(state, plane);278if (IS_ERR(plane_state)) {279ret = PTR_ERR(plane_state);280goto fail;281}282283ret = drm_atomic_set_crtc_for_plane(plane_state, crtc);284if (ret != 0)285goto fail;286287drm_atomic_set_fb_for_plane(plane_state, fb);288plane_state->crtc_x = crtc_x;289plane_state->crtc_y = crtc_y;290plane_state->crtc_h = crtc_h;291plane_state->crtc_w = crtc_w;292plane_state->src_x = src_x;293plane_state->src_y = src_y;294plane_state->src_h = src_h;295plane_state->src_w = src_w;296297ret = drm_atomic_nonblocking_commit(state);298fail:299drm_atomic_state_put(state);300return ret;301}302303static void armada_overlay_reset(struct drm_plane *plane)304{305struct armada_overlay_state *state;306307if (plane->state)308__drm_atomic_helper_plane_destroy_state(plane->state);309kfree(plane->state);310plane->state = NULL;311312state = kzalloc(sizeof(*state), GFP_KERNEL);313if (state) {314state->colorkey_yr = 0xfefefe00;315state->colorkey_ug = 0x01010100;316state->colorkey_vb = 0x01010100;317state->colorkey_mode = CFG_CKMODE(CKMODE_RGB) |318CFG_ALPHAM_GRA | CFG_ALPHA(0);319state->colorkey_enable = ADV_GRACOLORKEY;320state->brightness = DEFAULT_BRIGHTNESS;321state->contrast = DEFAULT_CONTRAST;322state->saturation = DEFAULT_SATURATION;323__drm_atomic_helper_plane_reset(plane, &state->base.base);324state->base.base.color_encoding = DEFAULT_ENCODING;325state->base.base.color_range = DRM_COLOR_YCBCR_LIMITED_RANGE;326}327}328329static struct drm_plane_state *330armada_overlay_duplicate_state(struct drm_plane *plane)331{332struct armada_overlay_state *state;333334if (WARN_ON(!plane->state))335return NULL;336337state = kmemdup(plane->state, sizeof(*state), GFP_KERNEL);338if (state)339__drm_atomic_helper_plane_duplicate_state(plane,340&state->base.base);341return &state->base.base;342}343344static int armada_overlay_set_property(struct drm_plane *plane,345struct drm_plane_state *state, struct drm_property *property,346uint64_t val)347{348struct armada_private *priv = drm_to_armada_dev(plane->dev);349350#define K2R(val) (((val) >> 0) & 0xff)351#define K2G(val) (((val) >> 8) & 0xff)352#define K2B(val) (((val) >> 16) & 0xff)353if (property == priv->colorkey_prop) {354#define CCC(v) ((v) << 24 | (v) << 16 | (v) << 8)355drm_to_overlay_state(state)->colorkey_yr = CCC(K2R(val));356drm_to_overlay_state(state)->colorkey_ug = CCC(K2G(val));357drm_to_overlay_state(state)->colorkey_vb = CCC(K2B(val));358#undef CCC359} else if (property == priv->colorkey_min_prop) {360drm_to_overlay_state(state)->colorkey_yr &= ~0x00ff0000;361drm_to_overlay_state(state)->colorkey_yr |= K2R(val) << 16;362drm_to_overlay_state(state)->colorkey_ug &= ~0x00ff0000;363drm_to_overlay_state(state)->colorkey_ug |= K2G(val) << 16;364drm_to_overlay_state(state)->colorkey_vb &= ~0x00ff0000;365drm_to_overlay_state(state)->colorkey_vb |= K2B(val) << 16;366} else if (property == priv->colorkey_max_prop) {367drm_to_overlay_state(state)->colorkey_yr &= ~0xff000000;368drm_to_overlay_state(state)->colorkey_yr |= K2R(val) << 24;369drm_to_overlay_state(state)->colorkey_ug &= ~0xff000000;370drm_to_overlay_state(state)->colorkey_ug |= K2G(val) << 24;371drm_to_overlay_state(state)->colorkey_vb &= ~0xff000000;372drm_to_overlay_state(state)->colorkey_vb |= K2B(val) << 24;373} else if (property == priv->colorkey_val_prop) {374drm_to_overlay_state(state)->colorkey_yr &= ~0x0000ff00;375drm_to_overlay_state(state)->colorkey_yr |= K2R(val) << 8;376drm_to_overlay_state(state)->colorkey_ug &= ~0x0000ff00;377drm_to_overlay_state(state)->colorkey_ug |= K2G(val) << 8;378drm_to_overlay_state(state)->colorkey_vb &= ~0x0000ff00;379drm_to_overlay_state(state)->colorkey_vb |= K2B(val) << 8;380} else if (property == priv->colorkey_alpha_prop) {381drm_to_overlay_state(state)->colorkey_yr &= ~0x000000ff;382drm_to_overlay_state(state)->colorkey_yr |= K2R(val);383drm_to_overlay_state(state)->colorkey_ug &= ~0x000000ff;384drm_to_overlay_state(state)->colorkey_ug |= K2G(val);385drm_to_overlay_state(state)->colorkey_vb &= ~0x000000ff;386drm_to_overlay_state(state)->colorkey_vb |= K2B(val);387} else if (property == priv->colorkey_mode_prop) {388if (val == CKMODE_DISABLE) {389drm_to_overlay_state(state)->colorkey_mode =390CFG_CKMODE(CKMODE_DISABLE) |391CFG_ALPHAM_CFG | CFG_ALPHA(255);392drm_to_overlay_state(state)->colorkey_enable = 0;393} else {394drm_to_overlay_state(state)->colorkey_mode =395CFG_CKMODE(val) |396CFG_ALPHAM_GRA | CFG_ALPHA(0);397drm_to_overlay_state(state)->colorkey_enable =398ADV_GRACOLORKEY;399}400} else if (property == priv->brightness_prop) {401drm_to_overlay_state(state)->brightness = val - 256;402} else if (property == priv->contrast_prop) {403drm_to_overlay_state(state)->contrast = val;404} else if (property == priv->saturation_prop) {405drm_to_overlay_state(state)->saturation = val;406} else {407return -EINVAL;408}409return 0;410}411412static int armada_overlay_get_property(struct drm_plane *plane,413const struct drm_plane_state *state, struct drm_property *property,414uint64_t *val)415{416struct armada_private *priv = drm_to_armada_dev(plane->dev);417418#define C2K(c,s) (((c) >> (s)) & 0xff)419#define R2BGR(r,g,b,s) (C2K(r,s) << 0 | C2K(g,s) << 8 | C2K(b,s) << 16)420if (property == priv->colorkey_prop) {421/* Do best-efforts here for this property */422*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,423drm_to_overlay_state(state)->colorkey_ug,424drm_to_overlay_state(state)->colorkey_vb, 16);425/* If min != max, or min != val, error out */426if (*val != R2BGR(drm_to_overlay_state(state)->colorkey_yr,427drm_to_overlay_state(state)->colorkey_ug,428drm_to_overlay_state(state)->colorkey_vb, 24) ||429*val != R2BGR(drm_to_overlay_state(state)->colorkey_yr,430drm_to_overlay_state(state)->colorkey_ug,431drm_to_overlay_state(state)->colorkey_vb, 8))432return -EINVAL;433} else if (property == priv->colorkey_min_prop) {434*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,435drm_to_overlay_state(state)->colorkey_ug,436drm_to_overlay_state(state)->colorkey_vb, 16);437} else if (property == priv->colorkey_max_prop) {438*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,439drm_to_overlay_state(state)->colorkey_ug,440drm_to_overlay_state(state)->colorkey_vb, 24);441} else if (property == priv->colorkey_val_prop) {442*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,443drm_to_overlay_state(state)->colorkey_ug,444drm_to_overlay_state(state)->colorkey_vb, 8);445} else if (property == priv->colorkey_alpha_prop) {446*val = R2BGR(drm_to_overlay_state(state)->colorkey_yr,447drm_to_overlay_state(state)->colorkey_ug,448drm_to_overlay_state(state)->colorkey_vb, 0);449} else if (property == priv->colorkey_mode_prop) {450*val = FIELD_GET(CFG_CKMODE_MASK,451drm_to_overlay_state(state)->colorkey_mode);452} else if (property == priv->brightness_prop) {453*val = drm_to_overlay_state(state)->brightness + 256;454} else if (property == priv->contrast_prop) {455*val = drm_to_overlay_state(state)->contrast;456} else if (property == priv->saturation_prop) {457*val = drm_to_overlay_state(state)->saturation;458} else {459return -EINVAL;460}461return 0;462}463464static const struct drm_plane_funcs armada_ovl_plane_funcs = {465.update_plane = armada_overlay_plane_update,466.disable_plane = drm_atomic_helper_disable_plane,467.destroy = drm_plane_helper_destroy,468.reset = armada_overlay_reset,469.atomic_duplicate_state = armada_overlay_duplicate_state,470.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,471.atomic_set_property = armada_overlay_set_property,472.atomic_get_property = armada_overlay_get_property,473};474475static const uint32_t armada_ovl_formats[] = {476DRM_FORMAT_UYVY,477DRM_FORMAT_YUYV,478DRM_FORMAT_YUV420,479DRM_FORMAT_YVU420,480DRM_FORMAT_YUV422,481DRM_FORMAT_YVU422,482DRM_FORMAT_VYUY,483DRM_FORMAT_YVYU,484DRM_FORMAT_ARGB8888,485DRM_FORMAT_ABGR8888,486DRM_FORMAT_XRGB8888,487DRM_FORMAT_XBGR8888,488DRM_FORMAT_RGB888,489DRM_FORMAT_BGR888,490DRM_FORMAT_ARGB1555,491DRM_FORMAT_ABGR1555,492DRM_FORMAT_RGB565,493DRM_FORMAT_BGR565,494};495496static const struct drm_prop_enum_list armada_drm_colorkey_enum_list[] = {497{ CKMODE_DISABLE, "disabled" },498{ CKMODE_Y, "Y component" },499{ CKMODE_U, "U component" },500{ CKMODE_V, "V component" },501{ CKMODE_RGB, "RGB" },502{ CKMODE_R, "R component" },503{ CKMODE_G, "G component" },504{ CKMODE_B, "B component" },505};506507static int armada_overlay_create_properties(struct drm_device *dev)508{509struct armada_private *priv = drm_to_armada_dev(dev);510511if (priv->colorkey_prop)512return 0;513514priv->colorkey_prop = drm_property_create_range(dev, 0,515"colorkey", 0, 0xffffff);516priv->colorkey_min_prop = drm_property_create_range(dev, 0,517"colorkey_min", 0, 0xffffff);518priv->colorkey_max_prop = drm_property_create_range(dev, 0,519"colorkey_max", 0, 0xffffff);520priv->colorkey_val_prop = drm_property_create_range(dev, 0,521"colorkey_val", 0, 0xffffff);522priv->colorkey_alpha_prop = drm_property_create_range(dev, 0,523"colorkey_alpha", 0, 0xffffff);524priv->colorkey_mode_prop = drm_property_create_enum(dev, 0,525"colorkey_mode",526armada_drm_colorkey_enum_list,527ARRAY_SIZE(armada_drm_colorkey_enum_list));528priv->brightness_prop = drm_property_create_range(dev, 0,529"brightness", 0, 256 + 255);530priv->contrast_prop = drm_property_create_range(dev, 0,531"contrast", 0, 0x7fff);532priv->saturation_prop = drm_property_create_range(dev, 0,533"saturation", 0, 0x7fff);534535if (!priv->colorkey_prop)536return -ENOMEM;537538return 0;539}540541int armada_overlay_plane_create(struct drm_device *dev, unsigned long crtcs)542{543struct armada_private *priv = drm_to_armada_dev(dev);544struct drm_mode_object *mobj;545struct drm_plane *overlay;546int ret;547548ret = armada_overlay_create_properties(dev);549if (ret)550return ret;551552overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);553if (!overlay)554return -ENOMEM;555556drm_plane_helper_add(overlay, &armada_overlay_plane_helper_funcs);557558ret = drm_universal_plane_init(dev, overlay, crtcs,559&armada_ovl_plane_funcs,560armada_ovl_formats,561ARRAY_SIZE(armada_ovl_formats),562NULL,563DRM_PLANE_TYPE_OVERLAY, NULL);564if (ret) {565kfree(overlay);566return ret;567}568569mobj = &overlay->base;570drm_object_attach_property(mobj, priv->colorkey_prop,5710x0101fe);572drm_object_attach_property(mobj, priv->colorkey_min_prop,5730x0101fe);574drm_object_attach_property(mobj, priv->colorkey_max_prop,5750x0101fe);576drm_object_attach_property(mobj, priv->colorkey_val_prop,5770x0101fe);578drm_object_attach_property(mobj, priv->colorkey_alpha_prop,5790x000000);580drm_object_attach_property(mobj, priv->colorkey_mode_prop,581CKMODE_RGB);582drm_object_attach_property(mobj, priv->brightness_prop,583256 + DEFAULT_BRIGHTNESS);584drm_object_attach_property(mobj, priv->contrast_prop,585DEFAULT_CONTRAST);586drm_object_attach_property(mobj, priv->saturation_prop,587DEFAULT_SATURATION);588589ret = drm_plane_create_color_properties(overlay,590BIT(DRM_COLOR_YCBCR_BT601) |591BIT(DRM_COLOR_YCBCR_BT709),592BIT(DRM_COLOR_YCBCR_LIMITED_RANGE),593DEFAULT_ENCODING,594DRM_COLOR_YCBCR_LIMITED_RANGE);595596return ret;597}598599600