1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. 4 * Copyright (C) 2013 Red Hat 5 * Author: Rob Clark <robdclark@gmail.com> 6 */ 7 8 #ifndef _DPU_PLANE_H_ 9 #define _DPU_PLANE_H_ 10 11 #include <drm/drm_crtc.h> 12 13 #include "dpu_kms.h" 14 #include "dpu_hw_mdss.h" 15 #include "dpu_hw_sspp.h" 16 17 /** 18 * struct dpu_plane_state: Define dpu extension of drm plane state object 19 * @base: base drm plane state object 20 * @aspace: pointer to address space for input/output buffers 21 * @pipe: software pipe description 22 * @stage: assigned by crtc blender 23 * @needs_qos_remap: qos remap settings need to be updated 24 * @multirect_index: index of the rectangle of SSPP 25 * @multirect_mode: parallel or time multiplex multirect mode 26 * @pending: whether the current update is still pending 27 * @plane_fetch_bw: calculated BW per plane 28 * @plane_clk: calculated clk per plane 29 * @needs_dirtyfb: whether attached CRTC needs pixel data explicitly flushed 30 * @rotation: simplified drm rotation hint 31 */ 32 struct dpu_plane_state { 33 struct drm_plane_state base; 34 struct msm_gem_address_space *aspace; 35 struct dpu_sw_pipe pipe; 36 enum dpu_stage stage; 37 bool needs_qos_remap; 38 bool pending; 39 40 u64 plane_fetch_bw; 41 u64 plane_clk; 42 43 bool needs_dirtyfb; 44 unsigned int rotation; 45 }; 46 47 /** 48 * struct dpu_multirect_plane_states: Defines multirect pair of drm plane states 49 * @r0: drm plane configured on rect 0 50 * @r1: drm plane configured on rect 1 51 */ 52 struct dpu_multirect_plane_states { 53 const struct drm_plane_state *r0; 54 const struct drm_plane_state *r1; 55 }; 56 57 #define to_dpu_plane_state(x) \ 58 container_of(x, struct dpu_plane_state, base) 59 60 /** 61 * dpu_plane_flush - final plane operations before commit flush 62 * @plane: Pointer to drm plane structure 63 */ 64 void dpu_plane_flush(struct drm_plane *plane); 65 66 /** 67 * dpu_plane_set_error: enable/disable error condition 68 * @plane: pointer to drm_plane structure 69 */ 70 void dpu_plane_set_error(struct drm_plane *plane, bool error); 71 72 /** 73 * dpu_plane_init - create new dpu plane for the given pipe 74 * @dev: Pointer to DRM device 75 * @pipe: dpu hardware pipe identifier 76 * @type: Plane type - PRIMARY/OVERLAY/CURSOR 77 * @possible_crtcs: bitmask of crtc that can be attached to the given pipe 78 * 79 */ 80 struct drm_plane *dpu_plane_init(struct drm_device *dev, 81 uint32_t pipe, enum drm_plane_type type, 82 unsigned long possible_crtcs); 83 84 /** 85 * dpu_plane_validate_multirecti_v2 - validate the multirect planes 86 * against hw limitations 87 * @plane: drm plate states of the multirect pair 88 */ 89 int dpu_plane_validate_multirect_v2(struct dpu_multirect_plane_states *plane); 90 91 /** 92 * dpu_plane_color_fill - enables color fill on plane 93 * @plane: Pointer to DRM plane object 94 * @color: RGB fill color value, [23..16] Blue, [15..8] Green, [7..0] Red 95 * @alpha: 8-bit fill alpha value, 255 selects 100% alpha 96 * Returns: 0 on success 97 */ 98 int dpu_plane_color_fill(struct drm_plane *plane, 99 uint32_t color, uint32_t alpha); 100 101 #ifdef CONFIG_DEBUG_FS 102 void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable); 103 #else 104 static inline void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) {} 105 #endif 106 107 #endif /* _DPU_PLANE_H_ */ 108