Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
0004  * Copyright (C) 2013 Red Hat
0005  * Author: Rob Clark <robdclark@gmail.com>
0006  */
0007 
0008 #ifndef _DPU_PLANE_H_
0009 #define _DPU_PLANE_H_
0010 
0011 #include <drm/drm_crtc.h>
0012 
0013 #include "dpu_kms.h"
0014 #include "dpu_hw_mdss.h"
0015 #include "dpu_hw_sspp.h"
0016 
0017 /**
0018  * struct dpu_plane_state: Define dpu extension of drm plane state object
0019  * @base:   base drm plane state object
0020  * @aspace: pointer to address space for input/output buffers
0021  * @stage:  assigned by crtc blender
0022  * @needs_qos_remap: qos remap settings need to be updated
0023  * @multirect_index: index of the rectangle of SSPP
0024  * @multirect_mode: parallel or time multiplex multirect mode
0025  * @pending:    whether the current update is still pending
0026  * @plane_fetch_bw: calculated BW per plane
0027  * @plane_clk: calculated clk per plane
0028  * @needs_dirtyfb: whether attached CRTC needs pixel data explicitly flushed
0029  * @rotation: simplified drm rotation hint
0030  */
0031 struct dpu_plane_state {
0032     struct drm_plane_state base;
0033     struct msm_gem_address_space *aspace;
0034     enum dpu_stage stage;
0035     bool needs_qos_remap;
0036     uint32_t multirect_index;
0037     uint32_t multirect_mode;
0038     bool pending;
0039 
0040     u64 plane_fetch_bw;
0041     u64 plane_clk;
0042 
0043     bool needs_dirtyfb;
0044     unsigned int rotation;
0045 };
0046 
0047 /**
0048  * struct dpu_multirect_plane_states: Defines multirect pair of drm plane states
0049  * @r0: drm plane configured on rect 0
0050  * @r1: drm plane configured on rect 1
0051  */
0052 struct dpu_multirect_plane_states {
0053     const struct drm_plane_state *r0;
0054     const struct drm_plane_state *r1;
0055 };
0056 
0057 #define to_dpu_plane_state(x) \
0058     container_of(x, struct dpu_plane_state, base)
0059 
0060 /**
0061  * dpu_plane_pipe - return sspp identifier for the given plane
0062  * @plane:   Pointer to DRM plane object
0063  * Returns: sspp identifier of the given plane
0064  */
0065 enum dpu_sspp dpu_plane_pipe(struct drm_plane *plane);
0066 
0067 /**
0068  * is_dpu_plane_virtual - check for virtual plane
0069  * @plane: Pointer to DRM plane object
0070  * returns: true - if the plane is virtual
0071  *          false - if the plane is primary
0072  */
0073 bool is_dpu_plane_virtual(struct drm_plane *plane);
0074 
0075 /**
0076  * dpu_plane_get_ctl_flush - get control flush mask
0077  * @plane:   Pointer to DRM plane object
0078  * @ctl: Pointer to control hardware
0079  * @flush_sspp: Pointer to sspp flush control word
0080  */
0081 void dpu_plane_get_ctl_flush(struct drm_plane *plane, struct dpu_hw_ctl *ctl,
0082         u32 *flush_sspp);
0083 
0084 /**
0085  * dpu_plane_flush - final plane operations before commit flush
0086  * @plane: Pointer to drm plane structure
0087  */
0088 void dpu_plane_flush(struct drm_plane *plane);
0089 
0090 /**
0091  * dpu_plane_set_error: enable/disable error condition
0092  * @plane: pointer to drm_plane structure
0093  */
0094 void dpu_plane_set_error(struct drm_plane *plane, bool error);
0095 
0096 /**
0097  * dpu_plane_init - create new dpu plane for the given pipe
0098  * @dev:   Pointer to DRM device
0099  * @pipe:  dpu hardware pipe identifier
0100  * @type:  Plane type - PRIMARY/OVERLAY/CURSOR
0101  * @possible_crtcs: bitmask of crtc that can be attached to the given pipe
0102  * @master_plane_id: primary plane id of a multirect pipe. 0 value passed for
0103  *                   a regular plane initialization. A non-zero primary plane
0104  *                   id will be passed for a virtual pipe initialization.
0105  *
0106  */
0107 struct drm_plane *dpu_plane_init(struct drm_device *dev,
0108         uint32_t pipe, enum drm_plane_type type,
0109         unsigned long possible_crtcs, u32 master_plane_id);
0110 
0111 /**
0112  * dpu_plane_validate_multirecti_v2 - validate the multirect planes
0113  *                    against hw limitations
0114  * @plane: drm plate states of the multirect pair
0115  */
0116 int dpu_plane_validate_multirect_v2(struct dpu_multirect_plane_states *plane);
0117 
0118 /**
0119  * dpu_plane_clear_multirect - clear multirect bits for the given pipe
0120  * @drm_state: Pointer to DRM plane state
0121  */
0122 void dpu_plane_clear_multirect(const struct drm_plane_state *drm_state);
0123 
0124 /**
0125  * dpu_plane_color_fill - enables color fill on plane
0126  * @plane:  Pointer to DRM plane object
0127  * @color:  RGB fill color value, [23..16] Blue, [15..8] Green, [7..0] Red
0128  * @alpha:  8-bit fill alpha value, 255 selects 100% alpha
0129  * Returns: 0 on success
0130  */
0131 int dpu_plane_color_fill(struct drm_plane *plane,
0132         uint32_t color, uint32_t alpha);
0133 
0134 #ifdef CONFIG_DEBUG_FS
0135 void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable);
0136 #else
0137 static inline void dpu_plane_danger_signal_ctrl(struct drm_plane *plane, bool enable) {}
0138 #endif
0139 
0140 #endif /* _DPU_PLANE_H_ */