Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 1 | /* |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 2 | * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved. |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 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 | */ |
| 14 | |
| 15 | #ifndef __SDE_ENCODER_PHYS_H__ |
| 16 | #define __SDE_ENCODER_PHYS_H__ |
| 17 | |
| 18 | #include "sde_kms.h" |
| 19 | #include "sde_hw_intf.h" |
Lloyd Atkinson | a59eead | 2016-05-30 14:37:06 -0400 | [diff] [blame] | 20 | #include "sde_hw_pingpong.h" |
Clarence Ip | c475b08 | 2016-06-26 09:27:23 -0400 | [diff] [blame] | 21 | #include "sde_hw_ctl.h" |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 22 | #include "sde_hw_top.h" |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 23 | #include "sde_hw_wb.h" |
| 24 | #include "sde_hw_cdm.h" |
| 25 | |
| 26 | #define SDE_ENCODER_NAME_MAX 16 |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 27 | |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 28 | /** |
| 29 | * enum sde_enc_split_role - Role this physical encoder will play in a |
| 30 | * split-panel configuration, where one panel is master, and others slaves. |
| 31 | * Masters have extra responsibilities, like managing the VBLANK IRQ. |
| 32 | * @ENC_ROLE_SOLO: This is the one and only panel. This encoder is master. |
| 33 | * @ENC_ROLE_MASTER: This encoder is the master of a split panel config. |
| 34 | * @ENC_ROLE_SLAVE: This encoder is not the master of a split panel config. |
| 35 | */ |
| 36 | enum sde_enc_split_role { |
| 37 | ENC_ROLE_SOLO, |
| 38 | ENC_ROLE_MASTER, |
| 39 | ENC_ROLE_SLAVE |
| 40 | }; |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 41 | |
| 42 | struct sde_encoder_phys; |
| 43 | |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 44 | /** |
| 45 | * struct sde_encoder_virt_ops - Interface the containing virtual encoder |
| 46 | * provides for the physical encoders to use to callback. |
| 47 | * @handle_vblank_virt: Notify virtual encoder of vblank IRQ reception |
| 48 | * Note: This is called from IRQ handler context. |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 49 | * @handle_underrun_virt: Notify virtual encoder of underrun IRQ reception |
| 50 | * Note: This is called from IRQ handler context. |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 51 | * @handle_ready_for_kickoff: Notify virtual encoder that this phys encoder |
| 52 | * is now ready for the next kickoff. |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 53 | */ |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 54 | struct sde_encoder_virt_ops { |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 55 | void (*handle_vblank_virt)(struct drm_encoder *, |
| 56 | struct sde_encoder_phys *phys); |
| 57 | void (*handle_underrun_virt)(struct drm_encoder *, |
| 58 | struct sde_encoder_phys *phys); |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 59 | void (*handle_ready_for_kickoff)(struct drm_encoder *, |
| 60 | struct sde_encoder_phys *phys); |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 61 | }; |
| 62 | |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 63 | /** |
| 64 | * struct sde_encoder_phys_ops - Interface the physical encoders provide to |
| 65 | * the containing virtual encoder. |
| 66 | * @is_master: Whether this phys_enc is the current master |
| 67 | * encoder. Can be switched at enable time. Based |
| 68 | * on split_role and current mode (CMD/VID). |
| 69 | * @mode_fixup: DRM Call. Fixup a DRM mode. |
| 70 | * @mode_set: DRM Call. Set a DRM mode. |
| 71 | * This likely caches the mode, for use at enable. |
| 72 | * @enable: DRM Call. Enable a DRM mode. |
| 73 | * @disable: DRM Call. Disable mode. |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 74 | * @atomic_check: DRM Call. Atomic check new DRM state. |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 75 | * @destroy: DRM Call. Destroy and release resources. |
| 76 | * @get_hw_resources: Populate the structure with the hardware |
| 77 | * resources that this phys_enc is using. |
| 78 | * Expect no overlap between phys_encs. |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 79 | * @control_vblank_irq Register/Deregister for VBLANK IRQ |
| 80 | * @wait_for_commit_done: Wait for hardware to have flushed the |
| 81 | * current pending frames to hardware |
| 82 | * @prepare_for_kickoff: Do any work necessary prior to a kickoff |
| 83 | * and report whether need to wait before |
| 84 | * triggering the next kickoff |
| 85 | * (ie for previous tx to complete) |
| 86 | * @handle_post_kickoff: Do any work necessary post-kickoff work |
Clarence Ip | 110d15c | 2016-08-16 14:44:41 -0400 | [diff] [blame] | 87 | * @trigger_start: Process start event on physical encoder |
| 88 | * @needs_split_flush: Whether encoder type needs split flush |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 89 | */ |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 90 | |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 91 | struct sde_encoder_phys_ops { |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 92 | bool (*is_master)(struct sde_encoder_phys *encoder); |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 93 | bool (*mode_fixup)(struct sde_encoder_phys *encoder, |
| 94 | const struct drm_display_mode *mode, |
| 95 | struct drm_display_mode *adjusted_mode); |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 96 | void (*mode_set)(struct sde_encoder_phys *encoder, |
| 97 | struct drm_display_mode *mode, |
| 98 | struct drm_display_mode *adjusted_mode); |
| 99 | void (*enable)(struct sde_encoder_phys *encoder); |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 100 | void (*disable)(struct sde_encoder_phys *encoder); |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 101 | int (*atomic_check)(struct sde_encoder_phys *encoder, |
| 102 | struct drm_crtc_state *crtc_state, |
| 103 | struct drm_connector_state *conn_state); |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 104 | void (*destroy)(struct sde_encoder_phys *encoder); |
| 105 | void (*get_hw_resources)(struct sde_encoder_phys *encoder, |
Lloyd Atkinson | 11f3444 | 2016-08-11 11:19:52 -0400 | [diff] [blame] | 106 | struct sde_encoder_hw_resources *hw_res, |
| 107 | struct drm_connector_state *conn_state); |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 108 | int (*control_vblank_irq)(struct sde_encoder_phys *enc, bool enable); |
| 109 | int (*wait_for_commit_done)(struct sde_encoder_phys *phys_enc); |
| 110 | void (*prepare_for_kickoff)(struct sde_encoder_phys *phys_enc, |
| 111 | bool *wait_until_ready); |
| 112 | void (*handle_post_kickoff)(struct sde_encoder_phys *phys_enc); |
Clarence Ip | 110d15c | 2016-08-16 14:44:41 -0400 | [diff] [blame] | 113 | void (*trigger_start)(struct sde_encoder_phys *phys_enc); |
| 114 | bool (*needs_split_flush)(struct sde_encoder_phys *phys_enc); |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 115 | }; |
| 116 | |
| 117 | /** |
| 118 | * enum sde_enc_enable_state - current enabled state of the physical encoder |
| 119 | * @SDE_ENC_DISABLED: Encoder is disabled |
| 120 | * @SDE_ENC_ENABLING: Encoder transitioning to enabled |
| 121 | * Events bounding transition are encoder type specific |
| 122 | * @SDE_ENC_ENABLED: Encoder is enabled |
| 123 | */ |
| 124 | enum sde_enc_enable_state { |
| 125 | SDE_ENC_DISABLED, |
| 126 | SDE_ENC_ENABLING, |
| 127 | SDE_ENC_ENABLED |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 128 | }; |
| 129 | |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 130 | /** |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 131 | * enum sde_intr_idx - sde encoder interrupt index |
| 132 | * @INTR_IDX_VSYNC: Vsync interrupt for video mode panel |
| 133 | * @INTR_IDX_PINGPONG: Pingpong done unterrupt for cmd mode panel |
| 134 | * @INTR_IDX_UNDERRUN: Underrun unterrupt for video and cmd mode panel |
| 135 | * @INTR_IDX_RDPTR: Readpointer done unterrupt for cmd mode panel |
| 136 | */ |
| 137 | enum sde_intr_idx { |
| 138 | INTR_IDX_VSYNC, |
| 139 | INTR_IDX_PINGPONG, |
| 140 | INTR_IDX_UNDERRUN, |
| 141 | INTR_IDX_RDPTR, |
| 142 | INTR_IDX_MAX, |
| 143 | }; |
| 144 | |
| 145 | /** |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 146 | * struct sde_encoder_phys - physical encoder that drives a single INTF block |
| 147 | * tied to a specific panel / sub-panel. Abstract type, sub-classed by |
| 148 | * phys_vid or phys_cmd for video mode or command mode encs respectively. |
| 149 | * @parent: Pointer to the containing virtual encoder |
Lloyd Atkinson | 55987b0 | 2016-08-16 16:57:46 -0400 | [diff] [blame] | 150 | * @connector: If a mode is set, cached pointer to the active connector |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 151 | * @ops: Operations exposed to the virtual encoder |
| 152 | * @parent_ops: Callbacks exposed by the parent to the phys_enc |
| 153 | * @hw_mdptop: Hardware interface to the top registers |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 154 | * @hw_ctl: Hardware interface to the ctl registers |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 155 | * @hw_cdm: Hardware interface to the cdm registers |
| 156 | * @cdm_cfg: Chroma-down hardware configuration |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 157 | * @sde_kms: Pointer to the sde_kms top level |
| 158 | * @cached_mode: DRM mode cached at mode_set time, acted on in enable |
| 159 | * @enabled: Whether the encoder has enabled and running a mode |
| 160 | * @split_role: Role to play in a split-panel configuration |
Clarence Ip | 0352198 | 2016-08-26 10:49:47 -0400 | [diff] [blame] | 161 | * @intf_mode: Interface mode |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 162 | * @intf_idx: Interface index on sde hardware |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 163 | * @spin_lock: Lock for IRQ purposes |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 164 | * @enable_state: Enable state tracking |
Alan Kwong | baa5635 | 2016-10-04 09:38:11 -0400 | [diff] [blame] | 165 | * @vblank_refcount: Reference count of vblank request |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 166 | * @vsync_cnt: Vsync count for the physical encoder |
| 167 | * @underrun_cnt: Underrun count for the physical encoder |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 168 | */ |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 169 | struct sde_encoder_phys { |
| 170 | struct drm_encoder *parent; |
Lloyd Atkinson | 55987b0 | 2016-08-16 16:57:46 -0400 | [diff] [blame] | 171 | struct drm_connector *connector; |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 172 | struct sde_encoder_phys_ops ops; |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 173 | struct sde_encoder_virt_ops parent_ops; |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 174 | struct sde_hw_mdp *hw_mdptop; |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 175 | struct sde_hw_ctl *hw_ctl; |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 176 | struct sde_hw_cdm *hw_cdm; |
| 177 | struct sde_hw_cdm_cfg cdm_cfg; |
Ben Chan | 78647cd | 2016-06-26 22:02:47 -0400 | [diff] [blame] | 178 | struct sde_kms *sde_kms; |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 179 | struct drm_display_mode cached_mode; |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 180 | enum sde_enc_split_role split_role; |
Clarence Ip | 0352198 | 2016-08-26 10:49:47 -0400 | [diff] [blame] | 181 | enum sde_intf_mode intf_mode; |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 182 | enum sde_intf intf_idx; |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 183 | spinlock_t spin_lock; |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 184 | enum sde_enc_enable_state enable_state; |
Alan Kwong | baa5635 | 2016-10-04 09:38:11 -0400 | [diff] [blame] | 185 | atomic_t vblank_refcount; |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 186 | atomic_t vsync_cnt; |
| 187 | atomic_t underrun_cnt; |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 188 | }; |
| 189 | |
Ben Chan | 78647cd | 2016-06-26 22:02:47 -0400 | [diff] [blame] | 190 | /** |
| 191 | * struct sde_encoder_phys_vid - sub-class of sde_encoder_phys to handle video |
| 192 | * mode specific operations |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 193 | * @base: Baseclass physical encoder structure |
| 194 | * @irq_idx: IRQ interface lookup index |
Alan Kwong | a172ef5 | 2016-09-27 00:29:10 -0400 | [diff] [blame] | 195 | * @irq_cb: interrupt callback |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 196 | * @hw_intf: Hardware interface to the intf registers |
| 197 | * @vblank_completion: Completion event signaled on reception of the vsync irq |
Ben Chan | 78647cd | 2016-06-26 22:02:47 -0400 | [diff] [blame] | 198 | */ |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 199 | struct sde_encoder_phys_vid { |
| 200 | struct sde_encoder_phys base; |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 201 | int irq_idx[INTR_IDX_MAX]; |
Alan Kwong | a172ef5 | 2016-09-27 00:29:10 -0400 | [diff] [blame] | 202 | struct sde_irq_callback irq_cb[INTR_IDX_MAX]; |
Lloyd Atkinson | 5d72278 | 2016-05-30 14:09:41 -0400 | [diff] [blame] | 203 | struct sde_hw_intf *hw_intf; |
| 204 | struct completion vblank_completion; |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 205 | }; |
| 206 | |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 207 | /** |
Lloyd Atkinson | a59eead | 2016-05-30 14:37:06 -0400 | [diff] [blame] | 208 | * struct sde_encoder_phys_cmd - sub-class of sde_encoder_phys to handle command |
| 209 | * mode specific operations |
| 210 | * @base: Baseclass physical encoder structure |
| 211 | * @intf_idx: Intf Block index used by this phys encoder |
| 212 | * @stream_sel: Stream selection for multi-stream interfaces |
| 213 | * @hw_pp: Hardware interface to the ping pong registers |
| 214 | * @pp_rd_ptr_irq_idx: IRQ signifying panel's frame read pointer |
| 215 | * For CMD encoders, VBLANK is driven by the PP RD Done IRQ |
| 216 | * @pp_tx_done_irq_idx: IRQ signifying frame transmission to panel complete |
Alan Kwong | a172ef5 | 2016-09-27 00:29:10 -0400 | [diff] [blame] | 217 | * @irq_cb: interrupt callback |
Lloyd Atkinson | a59eead | 2016-05-30 14:37:06 -0400 | [diff] [blame] | 218 | * @pp_tx_done_wq: Wait queue that tracks when a commit is flushed |
| 219 | * to hardware after the reception of pp_done |
| 220 | * Used to prevent back to back commits |
| 221 | * @pending_cnt: Atomic counter tracking the number of kickoffs vs. |
| 222 | * the number of pp_done irqs. Should hover between 0-2 |
| 223 | * Incremented when a new kickoff is scheduled |
| 224 | * Decremented in pp_done irq |
| 225 | */ |
| 226 | struct sde_encoder_phys_cmd { |
| 227 | struct sde_encoder_phys base; |
| 228 | int intf_idx; |
| 229 | int stream_sel; |
| 230 | struct sde_hw_pingpong *hw_pp; |
Dhaval Patel | 81e8788 | 2016-10-19 21:41:56 -0700 | [diff] [blame] | 231 | int irq_idx[INTR_IDX_MAX]; |
Alan Kwong | a172ef5 | 2016-09-27 00:29:10 -0400 | [diff] [blame] | 232 | struct sde_irq_callback irq_cb[INTR_IDX_MAX]; |
Lloyd Atkinson | a59eead | 2016-05-30 14:37:06 -0400 | [diff] [blame] | 233 | wait_queue_head_t pp_tx_done_wq; |
| 234 | atomic_t pending_cnt; |
| 235 | }; |
| 236 | |
| 237 | /** |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 238 | * struct sde_encoder_phys_wb - sub-class of sde_encoder_phys to handle |
| 239 | * writeback specific operations |
| 240 | * @base: Baseclass physical encoder structure |
| 241 | * @hw_wb: Hardware interface to the wb registers |
| 242 | * @irq_idx: IRQ interface lookup index |
| 243 | * @wbdone_timeout: Timeout value for writeback done in msec |
| 244 | * @bypass_irqreg: Bypass irq register/unregister if non-zero |
| 245 | * @wbdone_complete: for wbdone irq synchronization |
| 246 | * @wb_cfg: Writeback hardware configuration |
| 247 | * @intf_cfg: Interface hardware configuration |
| 248 | * @wb_roi: Writeback region-of-interest |
| 249 | * @wb_fmt: Writeback pixel format |
| 250 | * @frame_count: Counter of completed writeback operations |
| 251 | * @kickoff_count: Counter of issued writeback operations |
| 252 | * @mmu_id: mmu identifier for non-secure/secure domain |
| 253 | * @wb_dev: Pointer to writeback device |
| 254 | * @start_time: Start time of writeback latest request |
| 255 | * @end_time: End time of writeback latest request |
| 256 | * @wb_name: Name of this writeback device |
| 257 | * @debugfs_root: Root entry of writeback debugfs |
| 258 | */ |
| 259 | struct sde_encoder_phys_wb { |
| 260 | struct sde_encoder_phys base; |
| 261 | struct sde_hw_wb *hw_wb; |
| 262 | int irq_idx; |
Alan Kwong | a172ef5 | 2016-09-27 00:29:10 -0400 | [diff] [blame] | 263 | struct sde_irq_callback irq_cb; |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 264 | u32 wbdone_timeout; |
| 265 | u32 bypass_irqreg; |
| 266 | struct completion wbdone_complete; |
| 267 | struct sde_hw_wb_cfg wb_cfg; |
| 268 | struct sde_hw_intf_cfg intf_cfg; |
| 269 | struct sde_rect wb_roi; |
| 270 | const struct sde_format *wb_fmt; |
| 271 | u32 frame_count; |
| 272 | u32 kickoff_count; |
| 273 | int mmu_id[SDE_IOMMU_DOMAIN_MAX]; |
| 274 | struct sde_wb_device *wb_dev; |
| 275 | ktime_t start_time; |
| 276 | ktime_t end_time; |
| 277 | #ifdef CONFIG_DEBUG_FS |
| 278 | char wb_name[SDE_ENCODER_NAME_MAX]; |
| 279 | struct dentry *debugfs_root; |
| 280 | #endif |
| 281 | }; |
| 282 | |
| 283 | /** |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 284 | * struct sde_enc_phys_init_params - initialization parameters for phys encs |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 285 | * @sde_kms: Pointer to the sde_kms top level |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 286 | * @parent: Pointer to the containing virtual encoder |
| 287 | * @parent_ops: Callbacks exposed by the parent to the phys_enc |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 288 | * @split_role: Role to play in a split-panel configuration |
| 289 | * @intf_idx: Interface index this phys_enc will control |
| 290 | * @wb_idx: Writeback index this phys_enc will control |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 291 | */ |
| 292 | struct sde_enc_phys_init_params { |
| 293 | struct sde_kms *sde_kms; |
| 294 | struct drm_encoder *parent; |
| 295 | struct sde_encoder_virt_ops parent_ops; |
| 296 | enum sde_enc_split_role split_role; |
| 297 | enum sde_intf intf_idx; |
| 298 | enum sde_wb wb_idx; |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 299 | }; |
| 300 | |
| 301 | /** |
| 302 | * sde_encoder_phys_vid_init - Construct a new video mode physical encoder |
| 303 | * @p: Pointer to init params structure |
Lloyd Atkinson | e5c2c0b | 2016-07-05 12:23:29 -0400 | [diff] [blame] | 304 | * Return: Error code or newly allocated encoder |
| 305 | */ |
| 306 | struct sde_encoder_phys *sde_encoder_phys_vid_init( |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 307 | struct sde_enc_phys_init_params *p); |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 308 | |
Lloyd Atkinson | a59eead | 2016-05-30 14:37:06 -0400 | [diff] [blame] | 309 | /** |
| 310 | * sde_encoder_phys_cmd_init - Construct a new command mode physical encoder |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 311 | * @p: Pointer to init params structure |
Lloyd Atkinson | a59eead | 2016-05-30 14:37:06 -0400 | [diff] [blame] | 312 | * Return: Error code or newly allocated encoder |
| 313 | */ |
| 314 | struct sde_encoder_phys *sde_encoder_phys_cmd_init( |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 315 | struct sde_enc_phys_init_params *p); |
Lloyd Atkinson | a59eead | 2016-05-30 14:37:06 -0400 | [diff] [blame] | 316 | |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 317 | /** |
| 318 | * sde_encoder_phys_wb_init - Construct a new writeback physical encoder |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 319 | * @p: Pointer to init params structure |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 320 | * Return: Error code or newly allocated encoder |
| 321 | */ |
| 322 | #ifdef CONFIG_DRM_SDE_WB |
| 323 | struct sde_encoder_phys *sde_encoder_phys_wb_init( |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 324 | struct sde_enc_phys_init_params *p); |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 325 | #else |
| 326 | static inline |
| 327 | struct sde_encoder_phys *sde_encoder_phys_wb_init( |
Lloyd Atkinson | 6ef6cb5 | 2016-07-06 11:49:18 -0400 | [diff] [blame] | 328 | struct sde_enc_phys_init_params *p) |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 329 | { |
| 330 | return NULL; |
| 331 | } |
| 332 | #endif |
Lloyd Atkinson | a59eead | 2016-05-30 14:37:06 -0400 | [diff] [blame] | 333 | |
Alan Kwong | bb27c09 | 2016-07-20 16:41:25 -0400 | [diff] [blame] | 334 | void sde_encoder_phys_setup_cdm(struct sde_encoder_phys *phys_enc, |
| 335 | struct drm_framebuffer *fb, const struct sde_format *format, |
| 336 | struct sde_rect *wb_roi); |
Lloyd Atkinson | a59eead | 2016-05-30 14:37:06 -0400 | [diff] [blame] | 337 | |
Clarence Ip | 110d15c | 2016-08-16 14:44:41 -0400 | [diff] [blame] | 338 | /** |
| 339 | * sde_encoder_helper_trigger_start - control start helper function |
| 340 | * This helper function may be optionally specified by physical |
| 341 | * encoders if they require ctl_start triggering. |
| 342 | * @phys_enc: Pointer to physical encoder structure |
| 343 | */ |
| 344 | void sde_encoder_helper_trigger_start(struct sde_encoder_phys *phys_enc); |
| 345 | |
Lloyd Atkinson | 55987b0 | 2016-08-16 16:57:46 -0400 | [diff] [blame] | 346 | |
| 347 | static inline enum sde_3d_blend_mode sde_encoder_helper_get_3d_blend_mode( |
| 348 | struct sde_encoder_phys *phys_enc) |
| 349 | { |
| 350 | enum sde_rm_topology_name topology; |
| 351 | |
| 352 | topology = sde_connector_get_topology_name(phys_enc->connector); |
| 353 | if (phys_enc->split_role == ENC_ROLE_SOLO && |
| 354 | topology == SDE_RM_TOPOLOGY_DUALPIPEMERGE) |
| 355 | return BLEND_3D_H_ROW_INT; |
| 356 | |
| 357 | return BLEND_3D_NONE; |
| 358 | } |
| 359 | |
Lloyd Atkinson | 09fed91 | 2016-06-24 18:14:13 -0400 | [diff] [blame] | 360 | #endif /* __sde_encoder_phys_H__ */ |