xref: /OK3568_Linux_fs/kernel/include/drm/drm_blend.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (c) 2016 Intel Corporation
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Permission to use, copy, modify, distribute, and sell this software and its
5*4882a593Smuzhiyun  * documentation for any purpose is hereby granted without fee, provided that
6*4882a593Smuzhiyun  * the above copyright notice appear in all copies and that both that copyright
7*4882a593Smuzhiyun  * notice and this permission notice appear in supporting documentation, and
8*4882a593Smuzhiyun  * that the name of the copyright holders not be used in advertising or
9*4882a593Smuzhiyun  * publicity pertaining to distribution of the software without specific,
10*4882a593Smuzhiyun  * written prior permission.  The copyright holders make no representations
11*4882a593Smuzhiyun  * about the suitability of this software for any purpose.  It is provided "as
12*4882a593Smuzhiyun  * is" without express or implied warranty.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15*4882a593Smuzhiyun  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16*4882a593Smuzhiyun  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17*4882a593Smuzhiyun  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18*4882a593Smuzhiyun  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19*4882a593Smuzhiyun  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20*4882a593Smuzhiyun  * OF THIS SOFTWARE.
21*4882a593Smuzhiyun  */
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun #ifndef __DRM_BLEND_H__
24*4882a593Smuzhiyun #define __DRM_BLEND_H__
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #include <linux/list.h>
27*4882a593Smuzhiyun #include <linux/ctype.h>
28*4882a593Smuzhiyun #include <drm/drm_mode.h>
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #define DRM_MODE_BLEND_PREMULTI		0
31*4882a593Smuzhiyun #define DRM_MODE_BLEND_COVERAGE		1
32*4882a593Smuzhiyun #define DRM_MODE_BLEND_PIXEL_NONE	2
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun struct drm_device;
35*4882a593Smuzhiyun struct drm_atomic_state;
36*4882a593Smuzhiyun struct drm_plane;
37*4882a593Smuzhiyun 
drm_rotation_90_or_270(unsigned int rotation)38*4882a593Smuzhiyun static inline bool drm_rotation_90_or_270(unsigned int rotation)
39*4882a593Smuzhiyun {
40*4882a593Smuzhiyun 	return rotation & (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270);
41*4882a593Smuzhiyun }
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun #define DRM_BLEND_ALPHA_OPAQUE		0xffff
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun int drm_plane_create_alpha_property(struct drm_plane *plane);
46*4882a593Smuzhiyun int drm_plane_create_rotation_property(struct drm_plane *plane,
47*4882a593Smuzhiyun 				       unsigned int rotation,
48*4882a593Smuzhiyun 				       unsigned int supported_rotations);
49*4882a593Smuzhiyun unsigned int drm_rotation_simplify(unsigned int rotation,
50*4882a593Smuzhiyun 				   unsigned int supported_rotations);
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun int drm_plane_create_zpos_property(struct drm_plane *plane,
53*4882a593Smuzhiyun 				   unsigned int zpos,
54*4882a593Smuzhiyun 				   unsigned int min, unsigned int max);
55*4882a593Smuzhiyun int drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
56*4882a593Smuzhiyun 					     unsigned int zpos);
57*4882a593Smuzhiyun int drm_atomic_normalize_zpos(struct drm_device *dev,
58*4882a593Smuzhiyun 			      struct drm_atomic_state *state);
59*4882a593Smuzhiyun int drm_plane_create_blend_mode_property(struct drm_plane *plane,
60*4882a593Smuzhiyun 					 unsigned int supported_modes);
61*4882a593Smuzhiyun #endif
62