brintos

brintos / linux-shallow public Read only

0
0
Text · 4.1 KiB · e63db8a Raw
132 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.4 */5 6#ifndef __DPU_RM_H__7#define __DPU_RM_H__8 9#include <linux/list.h>10 11#include "msm_kms.h"12#include "dpu_hw_top.h"13 14struct dpu_global_state;15 16/**17 * struct dpu_rm - DPU dynamic hardware resource manager18 * @pingpong_blks: array of pingpong hardware resources19 * @mixer_blks: array of layer mixer hardware resources20 * @ctl_blks: array of ctl hardware resources21 * @hw_intf: array of intf hardware resources22 * @hw_wb: array of wb hardware resources23 * @dspp_blks: array of dspp hardware resources24 * @hw_sspp: array of sspp hardware resources25 * @cdm_blk: cdm hardware resource26 */27struct dpu_rm {28	struct dpu_hw_blk *pingpong_blks[PINGPONG_MAX - PINGPONG_0];29	struct dpu_hw_blk *mixer_blks[LM_MAX - LM_0];30	struct dpu_hw_blk *ctl_blks[CTL_MAX - CTL_0];31	struct dpu_hw_intf *hw_intf[INTF_MAX - INTF_0];32	struct dpu_hw_wb *hw_wb[WB_MAX - WB_0];33	struct dpu_hw_blk *dspp_blks[DSPP_MAX - DSPP_0];34	struct dpu_hw_blk *merge_3d_blks[MERGE_3D_MAX - MERGE_3D_0];35	struct dpu_hw_blk *dsc_blks[DSC_MAX - DSC_0];36	struct dpu_hw_sspp *hw_sspp[SSPP_MAX - SSPP_NONE];37	struct dpu_hw_blk *cdm_blk;38};39 40/**41 * dpu_rm_init - Read hardware catalog and create reservation tracking objects42 *	for all HW blocks.43 * @dev:  Corresponding device for devres management44 * @rm: DPU Resource Manager handle45 * @cat: Pointer to hardware catalog46 * @mdss_data: Pointer to MDSS / UBWC configuration47 * @mmio: mapped register io address of MDP48 * @Return: 0 on Success otherwise -ERROR49 */50int dpu_rm_init(struct drm_device *dev,51		struct dpu_rm *rm,52		const struct dpu_mdss_cfg *cat,53		const struct msm_mdss_data *mdss_data,54		void __iomem *mmio);55 56/**57 * dpu_rm_reserve - Given a CRTC->Encoder->Connector display chain, analyze58 *	the use connections and user requirements, specified through related59 *	topology control properties, and reserve hardware blocks to that60 *	display chain.61 *	HW blocks can then be accessed through dpu_rm_get_* functions.62 *	HW Reservations should be released via dpu_rm_release_hw.63 * @rm: DPU Resource Manager handle64 * @drm_enc: DRM Encoder handle65 * @crtc_state: Proposed Atomic DRM CRTC State handle66 * @topology: Pointer to topology info for the display67 * @Return: 0 on Success otherwise -ERROR68 */69int dpu_rm_reserve(struct dpu_rm *rm,70		struct dpu_global_state *global_state,71		struct drm_encoder *drm_enc,72		struct drm_crtc_state *crtc_state,73		struct msm_display_topology topology);74 75/**76 * dpu_rm_reserve - Given the encoder for the display chain, release any77 *	HW blocks previously reserved for that use case.78 * @rm: DPU Resource Manager handle79 * @enc: DRM Encoder handle80 * @Return: 0 on Success otherwise -ERROR81 */82void dpu_rm_release(struct dpu_global_state *global_state,83		struct drm_encoder *enc);84 85/**86 * Get hw resources of the given type that are assigned to this encoder.87 */88int dpu_rm_get_assigned_resources(struct dpu_rm *rm,89	struct dpu_global_state *global_state, uint32_t enc_id,90	enum dpu_hw_blk_type type, struct dpu_hw_blk **blks, int blks_size);91 92/**93 * dpu_rm_print_state - output the RM private state94 * @p: DRM printer95 * @global_state: global state96 */97void dpu_rm_print_state(struct drm_printer *p,98			const struct dpu_global_state *global_state);99 100/**101 * dpu_rm_get_intf - Return a struct dpu_hw_intf instance given it's index.102 * @rm: DPU Resource Manager handle103 * @intf_idx: INTF's index104 */105static inline struct dpu_hw_intf *dpu_rm_get_intf(struct dpu_rm *rm, enum dpu_intf intf_idx)106{107	return rm->hw_intf[intf_idx - INTF_0];108}109 110/**111 * dpu_rm_get_wb - Return a struct dpu_hw_wb instance given it's index.112 * @rm: DPU Resource Manager handle113 * @wb_idx: WB index114 */115static inline struct dpu_hw_wb *dpu_rm_get_wb(struct dpu_rm *rm, enum dpu_wb wb_idx)116{117	return rm->hw_wb[wb_idx - WB_0];118}119 120/**121 * dpu_rm_get_sspp - Return a struct dpu_hw_sspp instance given it's index.122 * @rm: DPU Resource Manager handle123 * @sspp_idx: SSPP index124 */125static inline struct dpu_hw_sspp *dpu_rm_get_sspp(struct dpu_rm *rm, enum dpu_sspp sspp_idx)126{127	return rm->hw_sspp[sspp_idx - SSPP_NONE];128}129 130#endif /* __DPU_RM_H__ */131 132