WIP FPC-III support
[linux/fpc-iii.git] / drivers / gpu / drm / rcar-du / rcar_du_plane.h
blob81bbf207ad0edd4045ed5423c99b91f0b1696ba0
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * rcar_du_plane.h -- R-Car Display Unit Planes
5 * Copyright (C) 2013-2014 Renesas Electronics Corporation
7 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
8 */
10 #ifndef __RCAR_DU_PLANE_H__
11 #define __RCAR_DU_PLANE_H__
13 #include <drm/drm_plane.h>
15 struct rcar_du_format_info;
16 struct rcar_du_group;
19 * The RCAR DU has 8 hardware planes, shared between primary and overlay planes.
20 * As using overlay planes requires at least one of the CRTCs being enabled, no
21 * more than 7 overlay planes can be available. We thus create 1 primary plane
22 * per CRTC and 7 overlay planes, for a total of up to 9 KMS planes.
24 #define RCAR_DU_NUM_KMS_PLANES 9
25 #define RCAR_DU_NUM_HW_PLANES 8
27 enum rcar_du_plane_source {
28 RCAR_DU_PLANE_MEMORY,
29 RCAR_DU_PLANE_VSPD0,
30 RCAR_DU_PLANE_VSPD1,
33 struct rcar_du_plane {
34 struct drm_plane plane;
35 struct rcar_du_group *group;
38 static inline struct rcar_du_plane *to_rcar_plane(struct drm_plane *plane)
40 return container_of(plane, struct rcar_du_plane, plane);
43 /**
44 * struct rcar_du_plane_state - Driver-specific plane state
45 * @state: base DRM plane state
46 * @format: information about the pixel format used by the plane
47 * @hwindex: 0-based hardware plane index, -1 means unused
48 * @colorkey: value of the plane colorkey property
50 struct rcar_du_plane_state {
51 struct drm_plane_state state;
53 const struct rcar_du_format_info *format;
54 int hwindex;
55 enum rcar_du_plane_source source;
57 unsigned int colorkey;
60 static inline struct rcar_du_plane_state *
61 to_rcar_plane_state(struct drm_plane_state *state)
63 return container_of(state, struct rcar_du_plane_state, state);
66 int rcar_du_atomic_check_planes(struct drm_device *dev,
67 struct drm_atomic_state *state);
69 int __rcar_du_plane_atomic_check(struct drm_plane *plane,
70 struct drm_plane_state *state,
71 const struct rcar_du_format_info **format);
73 int rcar_du_planes_init(struct rcar_du_group *rgrp);
75 void __rcar_du_plane_setup(struct rcar_du_group *rgrp,
76 const struct rcar_du_plane_state *state);
78 static inline void rcar_du_plane_setup(struct rcar_du_plane *plane)
80 struct rcar_du_plane_state *state =
81 to_rcar_plane_state(plane->plane.state);
83 return __rcar_du_plane_setup(plane->group, state);
86 #endif /* __RCAR_DU_PLANE_H__ */