162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (c) 2016 Intel Corporation
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Permission to use, copy, modify, distribute, and sell this software and its
562306a36Sopenharmony_ci * documentation for any purpose is hereby granted without fee, provided that
662306a36Sopenharmony_ci * the above copyright notice appear in all copies and that both that copyright
762306a36Sopenharmony_ci * notice and this permission notice appear in supporting documentation, and
862306a36Sopenharmony_ci * that the name of the copyright holders not be used in advertising or
962306a36Sopenharmony_ci * publicity pertaining to distribution of the software without specific,
1062306a36Sopenharmony_ci * written prior permission.  The copyright holders make no representations
1162306a36Sopenharmony_ci * about the suitability of this software for any purpose.  It is provided "as
1262306a36Sopenharmony_ci * is" without express or implied warranty.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1562306a36Sopenharmony_ci * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1662306a36Sopenharmony_ci * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1762306a36Sopenharmony_ci * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
1862306a36Sopenharmony_ci * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
1962306a36Sopenharmony_ci * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
2062306a36Sopenharmony_ci * OF THIS SOFTWARE.
2162306a36Sopenharmony_ci */
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci#ifndef __DRM_BLEND_H__
2462306a36Sopenharmony_ci#define __DRM_BLEND_H__
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#include <linux/list.h>
2762306a36Sopenharmony_ci#include <linux/ctype.h>
2862306a36Sopenharmony_ci#include <drm/drm_mode.h>
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define DRM_MODE_BLEND_PREMULTI		0
3162306a36Sopenharmony_ci#define DRM_MODE_BLEND_COVERAGE		1
3262306a36Sopenharmony_ci#define DRM_MODE_BLEND_PIXEL_NONE	2
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_cistruct drm_device;
3562306a36Sopenharmony_cistruct drm_atomic_state;
3662306a36Sopenharmony_cistruct drm_plane;
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_cistatic inline bool drm_rotation_90_or_270(unsigned int rotation)
3962306a36Sopenharmony_ci{
4062306a36Sopenharmony_ci	return rotation & (DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_270);
4162306a36Sopenharmony_ci}
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define DRM_BLEND_ALPHA_OPAQUE		0xffff
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciint drm_plane_create_alpha_property(struct drm_plane *plane);
4662306a36Sopenharmony_ciint drm_plane_create_rotation_property(struct drm_plane *plane,
4762306a36Sopenharmony_ci				       unsigned int rotation,
4862306a36Sopenharmony_ci				       unsigned int supported_rotations);
4962306a36Sopenharmony_ciunsigned int drm_rotation_simplify(unsigned int rotation,
5062306a36Sopenharmony_ci				   unsigned int supported_rotations);
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciint drm_plane_create_zpos_property(struct drm_plane *plane,
5362306a36Sopenharmony_ci				   unsigned int zpos,
5462306a36Sopenharmony_ci				   unsigned int min, unsigned int max);
5562306a36Sopenharmony_ciint drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
5662306a36Sopenharmony_ci					     unsigned int zpos);
5762306a36Sopenharmony_ciint drm_atomic_normalize_zpos(struct drm_device *dev,
5862306a36Sopenharmony_ci			      struct drm_atomic_state *state);
5962306a36Sopenharmony_ciint drm_plane_create_blend_mode_property(struct drm_plane *plane,
6062306a36Sopenharmony_ci					 unsigned int supported_modes);
6162306a36Sopenharmony_ci#endif
62