18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2016 Intel Corporation
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, distribute, and sell this software and its
58c2ecf20Sopenharmony_ci * documentation for any purpose is hereby granted without fee, provided that
68c2ecf20Sopenharmony_ci * the above copyright notice appear in all copies and that both that copyright
78c2ecf20Sopenharmony_ci * notice and this permission notice appear in supporting documentation, and
88c2ecf20Sopenharmony_ci * that the name of the copyright holders not be used in advertising or
98c2ecf20Sopenharmony_ci * publicity pertaining to distribution of the software without specific,
108c2ecf20Sopenharmony_ci * written prior permission.  The copyright holders make no representations
118c2ecf20Sopenharmony_ci * about the suitability of this software for any purpose.  It is provided "as
128c2ecf20Sopenharmony_ci * is" without express or implied warranty.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
158c2ecf20Sopenharmony_ci * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
168c2ecf20Sopenharmony_ci * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
178c2ecf20Sopenharmony_ci * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
188c2ecf20Sopenharmony_ci * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
198c2ecf20Sopenharmony_ci * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
208c2ecf20Sopenharmony_ci * OF THIS SOFTWARE.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#ifndef __DRM_BLEND_H__
248c2ecf20Sopenharmony_ci#define __DRM_BLEND_H__
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#include <linux/list.h>
278c2ecf20Sopenharmony_ci#include <linux/ctype.h>
288c2ecf20Sopenharmony_ci#include <drm/drm_mode.h>
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define DRM_MODE_BLEND_PREMULTI		0
318c2ecf20Sopenharmony_ci#define DRM_MODE_BLEND_COVERAGE		1
328c2ecf20Sopenharmony_ci#define DRM_MODE_BLEND_PIXEL_NONE	2
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistruct drm_device;
358c2ecf20Sopenharmony_cistruct drm_atomic_state;
368c2ecf20Sopenharmony_cistruct drm_plane;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistatic inline bool drm_rotation_90_or_270(unsigned int rotation)
398c2ecf20Sopenharmony_ci{
408c2ecf20Sopenharmony_ci	return rotation & (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270);
418c2ecf20Sopenharmony_ci}
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#define DRM_BLEND_ALPHA_OPAQUE		0xffff
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciint drm_plane_create_alpha_property(struct drm_plane *plane);
468c2ecf20Sopenharmony_ciint drm_plane_create_rotation_property(struct drm_plane *plane,
478c2ecf20Sopenharmony_ci				       unsigned int rotation,
488c2ecf20Sopenharmony_ci				       unsigned int supported_rotations);
498c2ecf20Sopenharmony_ciunsigned int drm_rotation_simplify(unsigned int rotation,
508c2ecf20Sopenharmony_ci				   unsigned int supported_rotations);
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ciint drm_plane_create_zpos_property(struct drm_plane *plane,
538c2ecf20Sopenharmony_ci				   unsigned int zpos,
548c2ecf20Sopenharmony_ci				   unsigned int min, unsigned int max);
558c2ecf20Sopenharmony_ciint drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
568c2ecf20Sopenharmony_ci					     unsigned int zpos);
578c2ecf20Sopenharmony_ciint drm_atomic_normalize_zpos(struct drm_device *dev,
588c2ecf20Sopenharmony_ci			      struct drm_atomic_state *state);
598c2ecf20Sopenharmony_ciint drm_plane_create_blend_mode_property(struct drm_plane *plane,
608c2ecf20Sopenharmony_ci					 unsigned int supported_modes);
618c2ecf20Sopenharmony_ci#endif
62