1caab277bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
225fdd593SJeykumar Sankaran /*
325fdd593SJeykumar Sankaran * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
425fdd593SJeykumar Sankaran * Copyright (C) 2013 Red Hat
525fdd593SJeykumar Sankaran * Author: Rob Clark <robdclark@gmail.com>
625fdd593SJeykumar Sankaran */
725fdd593SJeykumar Sankaran
825fdd593SJeykumar Sankaran #ifndef _DPU_PLANE_H_
925fdd593SJeykumar Sankaran #define _DPU_PLANE_H_
1025fdd593SJeykumar Sankaran
1125fdd593SJeykumar Sankaran #include <drm/drm_crtc.h>
1225fdd593SJeykumar Sankaran
1325fdd593SJeykumar Sankaran #include "dpu_kms.h"
1425fdd593SJeykumar Sankaran #include "dpu_hw_mdss.h"
1525fdd593SJeykumar Sankaran #include "dpu_hw_sspp.h"
1625fdd593SJeykumar Sankaran
1725fdd593SJeykumar Sankaran /**
1825fdd593SJeykumar Sankaran * struct dpu_plane_state: Define dpu extension of drm plane state object
1925fdd593SJeykumar Sankaran * @base: base drm plane state object
2025fdd593SJeykumar Sankaran * @aspace: pointer to address space for input/output buffers
213cfcd130SDmitry Baryshkov * @pipe: software pipe description
22*80e8ae3bSDmitry Baryshkov * @r_pipe: software pipe description of the second pipe
236e0ce9ecSDmitry Baryshkov * @pipe_cfg: software pipe configuration
24*80e8ae3bSDmitry Baryshkov * @r_pipe_cfg: software pipe configuration for the second pipe
2525fdd593SJeykumar Sankaran * @stage: assigned by crtc blender
26854f6f1cSAbhinav Kumar * @needs_qos_remap: qos remap settings need to be updated
2725fdd593SJeykumar Sankaran * @multirect_index: index of the rectangle of SSPP
2825fdd593SJeykumar Sankaran * @multirect_mode: parallel or time multiplex multirect mode
2925fdd593SJeykumar Sankaran * @pending: whether the current update is still pending
30c33b7c03SKalyan Thota * @plane_fetch_bw: calculated BW per plane
31c33b7c03SKalyan Thota * @plane_clk: calculated clk per plane
329e4dde28SRob Clark * @needs_dirtyfb: whether attached CRTC needs pixel data explicitly flushed
33dabfdd89SVinod Polimera * @rotation: simplified drm rotation hint
3425fdd593SJeykumar Sankaran */
3525fdd593SJeykumar Sankaran struct dpu_plane_state {
3625fdd593SJeykumar Sankaran struct drm_plane_state base;
3725fdd593SJeykumar Sankaran struct msm_gem_address_space *aspace;
383cfcd130SDmitry Baryshkov struct dpu_sw_pipe pipe;
39*80e8ae3bSDmitry Baryshkov struct dpu_sw_pipe r_pipe;
406e0ce9ecSDmitry Baryshkov struct dpu_sw_pipe_cfg pipe_cfg;
41*80e8ae3bSDmitry Baryshkov struct dpu_sw_pipe_cfg r_pipe_cfg;
4225fdd593SJeykumar Sankaran enum dpu_stage stage;
43854f6f1cSAbhinav Kumar bool needs_qos_remap;
4425fdd593SJeykumar Sankaran bool pending;
4525fdd593SJeykumar Sankaran
46c33b7c03SKalyan Thota u64 plane_fetch_bw;
47c33b7c03SKalyan Thota u64 plane_clk;
489e4dde28SRob Clark
499e4dde28SRob Clark bool needs_dirtyfb;
50dabfdd89SVinod Polimera unsigned int rotation;
5125fdd593SJeykumar Sankaran };
5225fdd593SJeykumar Sankaran
5325fdd593SJeykumar Sankaran #define to_dpu_plane_state(x) \
5425fdd593SJeykumar Sankaran container_of(x, struct dpu_plane_state, base)
5525fdd593SJeykumar Sankaran
5625fdd593SJeykumar Sankaran /**
5725fdd593SJeykumar Sankaran * dpu_plane_flush - final plane operations before commit flush
5825fdd593SJeykumar Sankaran * @plane: Pointer to drm plane structure
5925fdd593SJeykumar Sankaran */
6025fdd593SJeykumar Sankaran void dpu_plane_flush(struct drm_plane *plane);
6125fdd593SJeykumar Sankaran
6225fdd593SJeykumar Sankaran /**
6325fdd593SJeykumar Sankaran * dpu_plane_set_error: enable/disable error condition
6425fdd593SJeykumar Sankaran * @plane: pointer to drm_plane structure
6525fdd593SJeykumar Sankaran */
6625fdd593SJeykumar Sankaran void dpu_plane_set_error(struct drm_plane *plane, bool error);
6725fdd593SJeykumar Sankaran
6825fdd593SJeykumar Sankaran /**
6925fdd593SJeykumar Sankaran * dpu_plane_init - create new dpu plane for the given pipe
7025fdd593SJeykumar Sankaran * @dev: Pointer to DRM device
7125fdd593SJeykumar Sankaran * @pipe: dpu hardware pipe identifier
7207ca1fc0SSravanthi Kollukuduru * @type: Plane type - PRIMARY/OVERLAY/CURSOR
7325fdd593SJeykumar Sankaran * @possible_crtcs: bitmask of crtc that can be attached to the given pipe
7425fdd593SJeykumar Sankaran *
7525fdd593SJeykumar Sankaran */
7625fdd593SJeykumar Sankaran struct drm_plane *dpu_plane_init(struct drm_device *dev,
7707ca1fc0SSravanthi Kollukuduru uint32_t pipe, enum drm_plane_type type,
78aabf9220SDmitry Baryshkov unsigned long possible_crtcs);
7925fdd593SJeykumar Sankaran
8025fdd593SJeykumar Sankaran /**
8125fdd593SJeykumar Sankaran * dpu_plane_color_fill - enables color fill on plane
8225fdd593SJeykumar Sankaran * @plane: Pointer to DRM plane object
8325fdd593SJeykumar Sankaran * @color: RGB fill color value, [23..16] Blue, [15..8] Green, [7..0] Red
8425fdd593SJeykumar Sankaran * @alpha: 8-bit fill alpha value, 255 selects 100% alpha
8525fdd593SJeykumar Sankaran * Returns: 0 on success
8625fdd593SJeykumar Sankaran */
8725fdd593SJeykumar Sankaran int dpu_plane_color_fill(struct drm_plane *plane,
8825fdd593SJeykumar Sankaran uint32_t color, uint32_t alpha);
8925fdd593SJeykumar Sankaran
9096536242SDmitry Baryshkov #ifdef CONFIG_DEBUG_FS
9196536242SDmitry Baryshkov void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable);
9296536242SDmitry Baryshkov #else
dpu_plane_danger_signal_ctrl(struct drm_plane * plane,bool enable)9396536242SDmitry Baryshkov static inline void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) {}
9496536242SDmitry Baryshkov #endif
9596536242SDmitry Baryshkov
9625fdd593SJeykumar Sankaran #endif /* _DPU_PLANE_H_ */
97