drm/rockchip: vop: alpha_pre_mul mode depend on user space

Change-Id: Iaada438902ddddbbd00890c53a58cc49af3c3d3e
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
This commit is contained in:
Sandy Huang
2018-02-11 16:54:27 +08:00
committed by Tao Huang
parent 424a08f4cb
commit ce0ec8d27b
3 changed files with 22 additions and 1 deletions

View File

@@ -1138,6 +1138,12 @@ static int rockchip_drm_create_properties(struct drm_device *dev)
return -ENOMEM;
private->global_alpha_prop = prop;
prop = drm_property_create_range(dev, DRM_MODE_PROP_ATOMIC,
"BLEND_MODE", 0, 1);
if (!prop)
return -ENOMEM;
private->blend_mode_prop = prop;
return drm_mode_create_tv_properties(dev, 0, NULL);
}

View File

@@ -176,6 +176,7 @@ struct rockchip_drm_private {
struct drm_property *eotf_prop;
struct drm_property *color_space_prop;
struct drm_property *global_alpha_prop;
struct drm_property *blend_mode_prop;
void *backlight;
struct drm_fb_helper *fbdev_helper;
struct drm_gem_object *fbdev_bo;

View File

@@ -168,6 +168,7 @@ struct vop_plane_state {
unsigned int csc_mode;
bool enable;
int global_alpha;
int blend_mode;
};
struct vop_win {
@@ -1659,7 +1660,8 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
SRC_FACTOR_M0(global_alpha_en ?
ALPHA_SRC_GLOBAL : ALPHA_ONE);
VOP_WIN_SET(vop, win, src_alpha_ctl, val);
VOP_WIN_SET(vop, win, alpha_pre_mul, 1);
VOP_WIN_SET(vop, win, alpha_pre_mul,
vop_plane_state->blend_mode);
VOP_WIN_SET(vop, win, alpha_mode, 1);
VOP_WIN_SET(vop, win, alpha_en, 1);
} else {
@@ -1782,6 +1784,11 @@ static int vop_atomic_plane_set_property(struct drm_plane *plane,
return 0;
}
if (property == private->blend_mode_prop) {
plane_state->blend_mode = val;
return 0;
}
DRM_ERROR("failed to set vop plane property\n");
return -EINVAL;
}
@@ -1820,6 +1827,11 @@ static int vop_atomic_plane_get_property(struct drm_plane *plane,
return 0;
}
if (property == private->blend_mode_prop) {
*val = plane_state->blend_mode;
return 0;
}
DRM_ERROR("failed to get vop plane property\n");
return -EINVAL;
}
@@ -3653,6 +3665,8 @@ static int vop_plane_init(struct vop *vop, struct vop_win *win,
if (VOP_WIN_SUPPORT(vop, win, global_alpha_val))
drm_object_attach_property(&win->base.base,
private->global_alpha_prop, 0xff);
drm_object_attach_property(&win->base.base,
private->blend_mode_prop, 0);
return 0;
}