2 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
3 * Copyright (C) 2013 Red Hat
4 * Author: Rob Clark <robdclark@gmail.com>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * You should have received a copy of the GNU General Public License along with
16 * this program. If not, see <http://www.gnu.org/licenses/>.
22 #include <drm/drm_crtc.h>
25 #include "dpu_hw_mdss.h"
26 #include "dpu_hw_sspp.h"
29 * struct dpu_plane_state: Define dpu extension of drm plane state object
30 * @base: base drm plane state object
31 * @aspace: pointer to address space for input/output buffers
32 * @stage: assigned by crtc blender
33 * @multirect_index: index of the rectangle of SSPP
34 * @multirect_mode: parallel or time multiplex multirect mode
35 * @pending: whether the current update is still pending
36 * @scaler3_cfg: configuration data for scaler3
37 * @pixel_ext: configuration data for pixel extensions
38 * @cdp_cfg: CDP configuration
40 struct dpu_plane_state {
41 struct drm_plane_state base;
42 struct msm_gem_address_space *aspace;
44 uint32_t multirect_index;
45 uint32_t multirect_mode;
48 /* scaler configuration */
49 struct dpu_hw_scaler3_cfg scaler3_cfg;
50 struct dpu_hw_pixel_ext pixel_ext;
52 struct dpu_hw_pipe_cdp_cfg cdp_cfg;
56 * struct dpu_multirect_plane_states: Defines multirect pair of drm plane states
57 * @r0: drm plane configured on rect 0
58 * @r1: drm plane configured on rect 1
60 struct dpu_multirect_plane_states {
61 const struct drm_plane_state *r0;
62 const struct drm_plane_state *r1;
65 #define to_dpu_plane_state(x) \
66 container_of(x, struct dpu_plane_state, base)
69 * dpu_plane_pipe - return sspp identifier for the given plane
70 * @plane: Pointer to DRM plane object
71 * Returns: sspp identifier of the given plane
73 enum dpu_sspp dpu_plane_pipe(struct drm_plane *plane);
76 * is_dpu_plane_virtual - check for virtual plane
77 * @plane: Pointer to DRM plane object
78 * returns: true - if the plane is virtual
79 * false - if the plane is primary
81 bool is_dpu_plane_virtual(struct drm_plane *plane);
84 * dpu_plane_get_ctl_flush - get control flush mask
85 * @plane: Pointer to DRM plane object
86 * @ctl: Pointer to control hardware
87 * @flush_sspp: Pointer to sspp flush control word
89 void dpu_plane_get_ctl_flush(struct drm_plane *plane, struct dpu_hw_ctl *ctl,
93 * dpu_plane_restore - restore hw state if previously power collapsed
94 * @plane: Pointer to drm plane structure
96 void dpu_plane_restore(struct drm_plane *plane);
99 * dpu_plane_flush - final plane operations before commit flush
100 * @plane: Pointer to drm plane structure
102 void dpu_plane_flush(struct drm_plane *plane);
105 * dpu_plane_set_error: enable/disable error condition
106 * @plane: pointer to drm_plane structure
108 void dpu_plane_set_error(struct drm_plane *plane, bool error);
111 * dpu_plane_init - create new dpu plane for the given pipe
112 * @dev: Pointer to DRM device
113 * @pipe: dpu hardware pipe identifier
114 * @type: Plane type - PRIMARY/OVERLAY/CURSOR
115 * @possible_crtcs: bitmask of crtc that can be attached to the given pipe
116 * @master_plane_id: primary plane id of a multirect pipe. 0 value passed for
117 * a regular plane initialization. A non-zero primary plane
118 * id will be passed for a virtual pipe initialization.
121 struct drm_plane *dpu_plane_init(struct drm_device *dev,
122 uint32_t pipe, enum drm_plane_type type,
123 unsigned long possible_crtcs, u32 master_plane_id);
126 * dpu_plane_validate_multirecti_v2 - validate the multirect planes
127 * against hw limitations
128 * @plane: drm plate states of the multirect pair
130 int dpu_plane_validate_multirect_v2(struct dpu_multirect_plane_states *plane);
133 * dpu_plane_clear_multirect - clear multirect bits for the given pipe
134 * @drm_state: Pointer to DRM plane state
136 void dpu_plane_clear_multirect(const struct drm_plane_state *drm_state);
139 * dpu_plane_color_fill - enables color fill on plane
140 * @plane: Pointer to DRM plane object
141 * @color: RGB fill color value, [23..16] Blue, [15..8] Green, [7..0] Red
142 * @alpha: 8-bit fill alpha value, 255 selects 100% alpha
143 * Returns: 0 on success
145 int dpu_plane_color_fill(struct drm_plane *plane,
146 uint32_t color, uint32_t alpha);
148 #endif /* _DPU_PLANE_H_ */