| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. |
|---|
| 3 | 4 | * Copyright (C) 2013 Red Hat |
|---|
| 4 | 5 | * Author: Rob Clark <robdclark@gmail.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 7 | | - * under the terms of the GNU General Public License version 2 as published by |
|---|
| 8 | | - * the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 13 | | - * more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License along with |
|---|
| 16 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | 6 | */ |
|---|
| 18 | 7 | |
|---|
| 19 | 8 | #ifndef __DPU_ENCODER_H__ |
|---|
| .. | .. |
|---|
| 32 | 21 | /** |
|---|
| 33 | 22 | * Encoder functions and data types |
|---|
| 34 | 23 | * @intfs: Interfaces this encoder is using, INTF_MODE_NONE if unused |
|---|
| 35 | | - * @needs_cdm: Encoder requests a CDM based on pixel format conversion needs |
|---|
| 36 | | - * @display_num_of_h_tiles: Number of horizontal tiles in case of split |
|---|
| 37 | | - * interface |
|---|
| 38 | | - * @topology: Topology of the display |
|---|
| 39 | 24 | */ |
|---|
| 40 | 25 | struct dpu_encoder_hw_resources { |
|---|
| 41 | 26 | enum dpu_intf_mode intfs[INTF_MAX]; |
|---|
| 42 | | - bool needs_cdm; |
|---|
| 43 | | - u32 display_num_of_h_tiles; |
|---|
| 44 | | -}; |
|---|
| 45 | | - |
|---|
| 46 | | -/** |
|---|
| 47 | | - * dpu_encoder_kickoff_params - info encoder requires at kickoff |
|---|
| 48 | | - * @affected_displays: bitmask, bit set means the ROI of the commit lies within |
|---|
| 49 | | - * the bounds of the physical display at the bit index |
|---|
| 50 | | - */ |
|---|
| 51 | | -struct dpu_encoder_kickoff_params { |
|---|
| 52 | | - unsigned long affected_displays; |
|---|
| 53 | 27 | }; |
|---|
| 54 | 28 | |
|---|
| 55 | 29 | /** |
|---|
| 56 | 30 | * dpu_encoder_get_hw_resources - Populate table of required hardware resources |
|---|
| 57 | 31 | * @encoder: encoder pointer |
|---|
| 58 | 32 | * @hw_res: resource table to populate with encoder required resources |
|---|
| 59 | | - * @conn_state: report hw reqs based on this proposed connector state |
|---|
| 60 | 33 | */ |
|---|
| 61 | 34 | void dpu_encoder_get_hw_resources(struct drm_encoder *encoder, |
|---|
| 62 | | - struct dpu_encoder_hw_resources *hw_res, |
|---|
| 63 | | - struct drm_connector_state *conn_state); |
|---|
| 35 | + struct dpu_encoder_hw_resources *hw_res); |
|---|
| 64 | 36 | |
|---|
| 65 | 37 | /** |
|---|
| 66 | | - * dpu_encoder_register_vblank_callback - provide callback to encoder that |
|---|
| 67 | | - * will be called on the next vblank. |
|---|
| 38 | + * dpu_encoder_assign_crtc - Link the encoder to the crtc it's assigned to |
|---|
| 68 | 39 | * @encoder: encoder pointer |
|---|
| 69 | | - * @cb: callback pointer, provide NULL to deregister and disable IRQs |
|---|
| 70 | | - * @data: user data provided to callback |
|---|
| 40 | + * @crtc: crtc pointer |
|---|
| 71 | 41 | */ |
|---|
| 72 | | -void dpu_encoder_register_vblank_callback(struct drm_encoder *encoder, |
|---|
| 73 | | - void (*cb)(void *), void *data); |
|---|
| 42 | +void dpu_encoder_assign_crtc(struct drm_encoder *encoder, |
|---|
| 43 | + struct drm_crtc *crtc); |
|---|
| 44 | + |
|---|
| 45 | +/** |
|---|
| 46 | + * dpu_encoder_toggle_vblank_for_crtc - Toggles vblank interrupts on or off if |
|---|
| 47 | + * the encoder is assigned to the given crtc |
|---|
| 48 | + * @encoder: encoder pointer |
|---|
| 49 | + * @crtc: crtc pointer |
|---|
| 50 | + * @enable: true if vblank should be enabled |
|---|
| 51 | + */ |
|---|
| 52 | +void dpu_encoder_toggle_vblank_for_crtc(struct drm_encoder *encoder, |
|---|
| 53 | + struct drm_crtc *crtc, bool enable); |
|---|
| 74 | 54 | |
|---|
| 75 | 55 | /** |
|---|
| 76 | 56 | * dpu_encoder_register_frame_event_callback - provide callback to encoder that |
|---|
| .. | .. |
|---|
| 88 | 68 | * Immediately: if no previous commit is outstanding. |
|---|
| 89 | 69 | * Delayed: Block until next trigger can be issued. |
|---|
| 90 | 70 | * @encoder: encoder pointer |
|---|
| 91 | | - * @params: kickoff time parameters |
|---|
| 92 | 71 | */ |
|---|
| 93 | | -void dpu_encoder_prepare_for_kickoff(struct drm_encoder *encoder, |
|---|
| 94 | | - struct dpu_encoder_kickoff_params *params); |
|---|
| 72 | +void dpu_encoder_prepare_for_kickoff(struct drm_encoder *encoder); |
|---|
| 95 | 73 | |
|---|
| 96 | 74 | /** |
|---|
| 97 | 75 | * dpu_encoder_trigger_kickoff_pending - Clear the flush bits from previous |
|---|
| .. | .. |
|---|
| 106 | 84 | * @encoder: encoder pointer |
|---|
| 107 | 85 | */ |
|---|
| 108 | 86 | void dpu_encoder_kickoff(struct drm_encoder *encoder); |
|---|
| 87 | + |
|---|
| 88 | +/** |
|---|
| 89 | + * dpu_encoder_wakeup_time - get the time of the next vsync |
|---|
| 90 | + */ |
|---|
| 91 | +int dpu_encoder_vsync_time(struct drm_encoder *drm_enc, ktime_t *wakeup_time); |
|---|
| 109 | 92 | |
|---|
| 110 | 93 | /** |
|---|
| 111 | 94 | * dpu_encoder_wait_for_event - Waits for encoder events |
|---|
| .. | .. |
|---|
| 134 | 117 | enum dpu_intf_mode dpu_encoder_get_intf_mode(struct drm_encoder *encoder); |
|---|
| 135 | 118 | |
|---|
| 136 | 119 | /** |
|---|
| 137 | | - * dpu_encoder_virt_restore - restore the encoder configs |
|---|
| 120 | + * dpu_encoder_virt_runtime_resume - pm runtime resume the encoder configs |
|---|
| 138 | 121 | * @encoder: encoder pointer |
|---|
| 139 | 122 | */ |
|---|
| 140 | | -void dpu_encoder_virt_restore(struct drm_encoder *encoder); |
|---|
| 123 | +void dpu_encoder_virt_runtime_resume(struct drm_encoder *encoder); |
|---|
| 141 | 124 | |
|---|
| 142 | 125 | /** |
|---|
| 143 | 126 | * dpu_encoder_init - initialize virtual encoder object |
|---|