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 * @pipe: software pipe description array 21 * @pipe_cfg: software pipe configuration array 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 * @layout: framebuffer memory layout 31 */ 32 struct dpu_plane_state { 33 struct drm_plane_state base; 34 struct dpu_sw_pipe pipe[PIPES_PER_PLANE]; 35 struct dpu_sw_pipe_cfg pipe_cfg[PIPES_PER_PLANE]; 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 45 struct dpu_hw_fmt_layout layout; 46 }; 47 48 #define to_dpu_plane_state(x) \ 49 container_of(x, struct dpu_plane_state, base) 50 51 void dpu_plane_flush(struct drm_plane *plane); 52 53 void dpu_plane_set_error(struct drm_plane *plane, bool error); 54 55 struct drm_plane *dpu_plane_init(struct drm_device *dev, 56 uint32_t pipe, enum drm_plane_type type, 57 unsigned long possible_crtcs); 58 59 struct drm_plane *dpu_plane_init_virtual(struct drm_device *dev, 60 enum drm_plane_type type, 61 unsigned long possible_crtcs); 62 63 int dpu_plane_color_fill(struct drm_plane *plane, 64 uint32_t color, uint32_t alpha); 65 66 #ifdef CONFIG_DEBUG_FS 67 void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable); 68 #else 69 static inline void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) {} 70 #endif 71 72 int dpu_assign_plane_resources(struct dpu_global_state *global_state, 73 struct drm_atomic_state *state, 74 struct drm_crtc *crtc, 75 struct drm_plane_state **states, 76 unsigned int num_planes); 77 78 #endif /* _DPU_PLANE_H_ */ 79