xref: /linux/include/drm/drm_blend.h (revision 90422201f8f2b4e26ab7bd43b92786a11c1ffebf)
118733802SDaniel Vetter /*
218733802SDaniel Vetter  * Copyright (c) 2016 Intel Corporation
318733802SDaniel Vetter  *
418733802SDaniel Vetter  * Permission to use, copy, modify, distribute, and sell this software and its
518733802SDaniel Vetter  * documentation for any purpose is hereby granted without fee, provided that
618733802SDaniel Vetter  * the above copyright notice appear in all copies and that both that copyright
718733802SDaniel Vetter  * notice and this permission notice appear in supporting documentation, and
818733802SDaniel Vetter  * that the name of the copyright holders not be used in advertising or
918733802SDaniel Vetter  * publicity pertaining to distribution of the software without specific,
1018733802SDaniel Vetter  * written prior permission.  The copyright holders make no representations
1118733802SDaniel Vetter  * about the suitability of this software for any purpose.  It is provided "as
1218733802SDaniel Vetter  * is" without express or implied warranty.
1318733802SDaniel Vetter  *
1418733802SDaniel Vetter  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1518733802SDaniel Vetter  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1618733802SDaniel Vetter  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1718733802SDaniel Vetter  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
1818733802SDaniel Vetter  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
1918733802SDaniel Vetter  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
2018733802SDaniel Vetter  * OF THIS SOFTWARE.
2118733802SDaniel Vetter  */
2218733802SDaniel Vetter 
2318733802SDaniel Vetter #ifndef __DRM_BLEND_H__
2418733802SDaniel Vetter #define __DRM_BLEND_H__
2518733802SDaniel Vetter 
2618733802SDaniel Vetter #include <linux/list.h>
2718733802SDaniel Vetter #include <linux/ctype.h>
28c2c446adSRobert Foss #include <drm/drm_mode.h>
2918733802SDaniel Vetter 
30*a5ec8332SLowry Li #define DRM_MODE_BLEND_PREMULTI		0
31*a5ec8332SLowry Li #define DRM_MODE_BLEND_COVERAGE		1
32*a5ec8332SLowry Li #define DRM_MODE_BLEND_PIXEL_NONE	2
33*a5ec8332SLowry Li 
3418733802SDaniel Vetter struct drm_device;
3518733802SDaniel Vetter struct drm_atomic_state;
369cf8f580STomi Valkeinen struct drm_plane;
3718733802SDaniel Vetter 
drm_rotation_90_or_270(unsigned int rotation)38bd2ef25dSVille Syrjälä static inline bool drm_rotation_90_or_270(unsigned int rotation)
39bd2ef25dSVille Syrjälä {
40c2c446adSRobert Foss 	return rotation & (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270);
41bd2ef25dSVille Syrjälä }
42bd2ef25dSVille Syrjälä 
43ae0e2826SMaxime Ripard #define DRM_BLEND_ALPHA_OPAQUE		0xffff
44ae0e2826SMaxime Ripard 
45ae0e2826SMaxime Ripard int drm_plane_create_alpha_property(struct drm_plane *plane);
46d138dd3cSVille Syrjälä int drm_plane_create_rotation_property(struct drm_plane *plane,
47d138dd3cSVille Syrjälä 				       unsigned int rotation,
48d138dd3cSVille Syrjälä 				       unsigned int supported_rotations);
4918733802SDaniel Vetter unsigned int drm_rotation_simplify(unsigned int rotation,
5018733802SDaniel Vetter 				   unsigned int supported_rotations);
5118733802SDaniel Vetter 
5218733802SDaniel Vetter int drm_plane_create_zpos_property(struct drm_plane *plane,
5318733802SDaniel Vetter 				   unsigned int zpos,
5418733802SDaniel Vetter 				   unsigned int min, unsigned int max);
5518733802SDaniel Vetter int drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
5618733802SDaniel Vetter 					     unsigned int zpos);
5718733802SDaniel Vetter int drm_atomic_normalize_zpos(struct drm_device *dev,
5818733802SDaniel Vetter 			      struct drm_atomic_state *state);
59*a5ec8332SLowry Li int drm_plane_create_blend_mode_property(struct drm_plane *plane,
60*a5ec8332SLowry Li 					 unsigned int supported_modes);
6118733802SDaniel Vetter #endif
62