| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 and |
|---|
| 6 | | - * only version 2 as published by the Free Software Foundation. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 9 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 11 | | - * GNU General Public License for more details. |
|---|
| 12 | | - * |
|---|
| 13 | 4 | */ |
|---|
| 14 | 5 | |
|---|
| 15 | 6 | #ifndef __DPU_ENCODER_PHYS_H__ |
|---|
| .. | .. |
|---|
| 22 | 13 | #include "dpu_hw_pingpong.h" |
|---|
| 23 | 14 | #include "dpu_hw_ctl.h" |
|---|
| 24 | 15 | #include "dpu_hw_top.h" |
|---|
| 25 | | -#include "dpu_hw_cdm.h" |
|---|
| 26 | 16 | #include "dpu_encoder.h" |
|---|
| 17 | +#include "dpu_crtc.h" |
|---|
| 27 | 18 | |
|---|
| 28 | 19 | #define DPU_ENCODER_NAME_MAX 16 |
|---|
| 29 | 20 | |
|---|
| .. | .. |
|---|
| 114 | 105 | * @handle_post_kickoff: Do any work necessary post-kickoff work |
|---|
| 115 | 106 | * @trigger_start: Process start event on physical encoder |
|---|
| 116 | 107 | * @needs_single_flush: Whether encoder slaves need to be flushed |
|---|
| 117 | | - * @setup_misr: Sets up MISR, enable and disables based on sysfs |
|---|
| 118 | | - * @collect_misr: Collects MISR data on frame update |
|---|
| 119 | | - * @hw_reset: Issue HW recovery such as CTL reset and clear |
|---|
| 120 | | - * DPU_ENC_ERR_NEEDS_HW_RESET state |
|---|
| 121 | 108 | * @irq_control: Handler to enable/disable all the encoder IRQs |
|---|
| 122 | 109 | * @prepare_idle_pc: phys encoder can update the vsync_enable status |
|---|
| 123 | 110 | * on idle power collapse prepare |
|---|
| .. | .. |
|---|
| 143 | 130 | struct drm_connector_state *conn_state); |
|---|
| 144 | 131 | void (*destroy)(struct dpu_encoder_phys *encoder); |
|---|
| 145 | 132 | void (*get_hw_resources)(struct dpu_encoder_phys *encoder, |
|---|
| 146 | | - struct dpu_encoder_hw_resources *hw_res, |
|---|
| 147 | | - struct drm_connector_state *conn_state); |
|---|
| 133 | + struct dpu_encoder_hw_resources *hw_res); |
|---|
| 148 | 134 | int (*control_vblank_irq)(struct dpu_encoder_phys *enc, bool enable); |
|---|
| 149 | 135 | int (*wait_for_commit_done)(struct dpu_encoder_phys *phys_enc); |
|---|
| 150 | 136 | int (*wait_for_tx_complete)(struct dpu_encoder_phys *phys_enc); |
|---|
| 151 | 137 | int (*wait_for_vblank)(struct dpu_encoder_phys *phys_enc); |
|---|
| 152 | | - void (*prepare_for_kickoff)(struct dpu_encoder_phys *phys_enc, |
|---|
| 153 | | - struct dpu_encoder_kickoff_params *params); |
|---|
| 138 | + void (*prepare_for_kickoff)(struct dpu_encoder_phys *phys_enc); |
|---|
| 154 | 139 | void (*handle_post_kickoff)(struct dpu_encoder_phys *phys_enc); |
|---|
| 155 | 140 | void (*trigger_start)(struct dpu_encoder_phys *phys_enc); |
|---|
| 156 | 141 | bool (*needs_single_flush)(struct dpu_encoder_phys *phys_enc); |
|---|
| 157 | | - |
|---|
| 158 | | - void (*setup_misr)(struct dpu_encoder_phys *phys_encs, |
|---|
| 159 | | - bool enable, u32 frame_count); |
|---|
| 160 | | - u32 (*collect_misr)(struct dpu_encoder_phys *phys_enc); |
|---|
| 161 | | - void (*hw_reset)(struct dpu_encoder_phys *phys_enc); |
|---|
| 162 | 142 | void (*irq_control)(struct dpu_encoder_phys *phys, bool enable); |
|---|
| 163 | 143 | void (*prepare_idle_pc)(struct dpu_encoder_phys *phys_enc); |
|---|
| 164 | 144 | void (*restore)(struct dpu_encoder_phys *phys); |
|---|
| .. | .. |
|---|
| 210 | 190 | * @parent_ops: Callbacks exposed by the parent to the phys_enc |
|---|
| 211 | 191 | * @hw_mdptop: Hardware interface to the top registers |
|---|
| 212 | 192 | * @hw_ctl: Hardware interface to the ctl registers |
|---|
| 213 | | - * @hw_cdm: Hardware interface to the cdm registers |
|---|
| 214 | | - * @cdm_cfg: Chroma-down hardware configuration |
|---|
| 215 | 193 | * @hw_pp: Hardware interface to the ping pong registers |
|---|
| 194 | + * @hw_intf: Hardware interface to the intf registers |
|---|
| 216 | 195 | * @dpu_kms: Pointer to the dpu_kms top level |
|---|
| 217 | 196 | * @cached_mode: DRM mode cached at mode_set time, acted on in enable |
|---|
| 218 | 197 | * @enabled: Whether the encoder has enabled and running a mode |
|---|
| 219 | 198 | * @split_role: Role to play in a split-panel configuration |
|---|
| 220 | 199 | * @intf_mode: Interface mode |
|---|
| 221 | 200 | * @intf_idx: Interface index on dpu hardware |
|---|
| 222 | | - * @topology_name: topology selected for the display |
|---|
| 223 | 201 | * @enc_spinlock: Virtual-Encoder-Wide Spin Lock for IRQ purposes |
|---|
| 224 | 202 | * @enable_state: Enable state tracking |
|---|
| 225 | 203 | * @vblank_refcount: Reference count of vblank request |
|---|
| .. | .. |
|---|
| 241 | 219 | const struct dpu_encoder_virt_ops *parent_ops; |
|---|
| 242 | 220 | struct dpu_hw_mdp *hw_mdptop; |
|---|
| 243 | 221 | struct dpu_hw_ctl *hw_ctl; |
|---|
| 244 | | - struct dpu_hw_cdm *hw_cdm; |
|---|
| 245 | | - struct dpu_hw_cdm_cfg cdm_cfg; |
|---|
| 246 | 222 | struct dpu_hw_pingpong *hw_pp; |
|---|
| 223 | + struct dpu_hw_intf *hw_intf; |
|---|
| 247 | 224 | struct dpu_kms *dpu_kms; |
|---|
| 248 | 225 | struct drm_display_mode cached_mode; |
|---|
| 249 | 226 | enum dpu_enc_split_role split_role; |
|---|
| 250 | 227 | enum dpu_intf_mode intf_mode; |
|---|
| 251 | 228 | enum dpu_intf intf_idx; |
|---|
| 252 | | - enum dpu_rm_topology_name topology_name; |
|---|
| 253 | 229 | spinlock_t *enc_spinlock; |
|---|
| 254 | 230 | enum dpu_enc_enable_state enable_state; |
|---|
| 255 | 231 | atomic_t vblank_refcount; |
|---|
| .. | .. |
|---|
| 266 | 242 | atomic_inc_return(&phys->pending_ctlstart_cnt); |
|---|
| 267 | 243 | return atomic_inc_return(&phys->pending_kickoff_cnt); |
|---|
| 268 | 244 | } |
|---|
| 269 | | - |
|---|
| 270 | | -/** |
|---|
| 271 | | - * struct dpu_encoder_phys_vid - sub-class of dpu_encoder_phys to handle video |
|---|
| 272 | | - * mode specific operations |
|---|
| 273 | | - * @base: Baseclass physical encoder structure |
|---|
| 274 | | - * @hw_intf: Hardware interface to the intf registers |
|---|
| 275 | | - * @timing_params: Current timing parameter |
|---|
| 276 | | - */ |
|---|
| 277 | | -struct dpu_encoder_phys_vid { |
|---|
| 278 | | - struct dpu_encoder_phys base; |
|---|
| 279 | | - struct dpu_hw_intf *hw_intf; |
|---|
| 280 | | - struct intf_timing_params timing_params; |
|---|
| 281 | | -}; |
|---|
| 282 | 245 | |
|---|
| 283 | 246 | /** |
|---|
| 284 | 247 | * struct dpu_encoder_phys_cmd - sub-class of dpu_encoder_phys to handle command |
|---|
| .. | .. |
|---|
| 355 | 318 | */ |
|---|
| 356 | 319 | void dpu_encoder_helper_trigger_start(struct dpu_encoder_phys *phys_enc); |
|---|
| 357 | 320 | |
|---|
| 358 | | -/** |
|---|
| 359 | | - * dpu_encoder_helper_hw_reset - issue ctl hw reset |
|---|
| 360 | | - * This helper function may be optionally specified by physical |
|---|
| 361 | | - * encoders if they require ctl hw reset. If state is currently |
|---|
| 362 | | - * DPU_ENC_ERR_NEEDS_HW_RESET, it is set back to DPU_ENC_ENABLED. |
|---|
| 363 | | - * @phys_enc: Pointer to physical encoder structure |
|---|
| 364 | | - */ |
|---|
| 365 | | -void dpu_encoder_helper_hw_reset(struct dpu_encoder_phys *phys_enc); |
|---|
| 366 | | - |
|---|
| 367 | 321 | static inline enum dpu_3d_blend_mode dpu_encoder_helper_get_3d_blend_mode( |
|---|
| 368 | 322 | struct dpu_encoder_phys *phys_enc) |
|---|
| 369 | 323 | { |
|---|
| 324 | + struct dpu_crtc_state *dpu_cstate; |
|---|
| 325 | + |
|---|
| 370 | 326 | if (!phys_enc || phys_enc->enable_state == DPU_ENC_DISABLING) |
|---|
| 371 | 327 | return BLEND_3D_NONE; |
|---|
| 372 | 328 | |
|---|
| 329 | + dpu_cstate = to_dpu_crtc_state(phys_enc->parent->crtc->state); |
|---|
| 330 | + |
|---|
| 373 | 331 | if (phys_enc->split_role == ENC_ROLE_SOLO && |
|---|
| 374 | | - phys_enc->topology_name == DPU_RM_TOPOLOGY_DUALPIPE_3DMERGE) |
|---|
| 332 | + dpu_cstate->num_mixers == CRTC_DUAL_MIXERS) |
|---|
| 375 | 333 | return BLEND_3D_H_ROW_INT; |
|---|
| 376 | 334 | |
|---|
| 377 | 335 | return BLEND_3D_NONE; |
|---|