| 1 | /* SPDX-License-Identifier: GPL-2.0 OR MIT */ |
| 2 | /************************************************************************** |
| 3 | * |
| 4 | * Copyright (c) 2024 Broadcom. All Rights Reserved. The term |
| 5 | * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. |
| 6 | * |
| 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | * copy of this software and associated documentation files (the |
| 9 | * "Software"), to deal in the Software without restriction, including |
| 10 | * without limitation the rights to use, copy, modify, merge, publish, |
| 11 | * distribute, sub license, and/or sell copies of the Software, and to |
| 12 | * permit persons to whom the Software is furnished to do so, subject to |
| 13 | * the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice (including the |
| 16 | * next paragraph) shall be included in all copies or substantial portions |
| 17 | * of the Software. |
| 18 | * |
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
| 22 | * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, |
| 23 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 24 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
| 25 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 26 | * |
| 27 | **************************************************************************/ |
| 28 | |
| 29 | #ifndef VMWGFX_VKMS_H_ |
| 30 | #define VMWGFX_VKMS_H_ |
| 31 | |
| 32 | #include <linux/hrtimer_types.h> |
| 33 | #include <linux/types.h> |
| 34 | |
| 35 | struct drm_atomic_state; |
| 36 | struct drm_crtc; |
| 37 | struct vmw_private; |
| 38 | struct vmw_surface; |
| 39 | |
| 40 | void vmw_vkms_init(struct vmw_private *vmw); |
| 41 | void vmw_vkms_cleanup(struct vmw_private *vmw); |
| 42 | |
| 43 | void vmw_vkms_modeset_lock(struct drm_crtc *crtc); |
| 44 | bool vmw_vkms_modeset_lock_relaxed(struct drm_crtc *crtc); |
| 45 | bool vmw_vkms_vblank_trylock(struct drm_crtc *crtc); |
| 46 | void vmw_vkms_unlock(struct drm_crtc *crtc); |
| 47 | |
| 48 | bool vmw_vkms_get_vblank_timestamp(struct drm_crtc *crtc, |
| 49 | int *max_error, |
| 50 | ktime_t *vblank_time, |
| 51 | bool in_vblank_irq); |
| 52 | int vmw_vkms_enable_vblank(struct drm_crtc *crtc); |
| 53 | void vmw_vkms_disable_vblank(struct drm_crtc *crtc); |
| 54 | |
| 55 | void vmw_vkms_crtc_init(struct drm_crtc *crtc); |
| 56 | void vmw_vkms_crtc_cleanup(struct drm_crtc *crtc); |
| 57 | void vmw_vkms_crtc_atomic_begin(struct drm_crtc *crtc, |
| 58 | struct drm_atomic_state *state); |
| 59 | void vmw_vkms_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_atomic_state *state); |
| 60 | void vmw_vkms_crtc_atomic_enable(struct drm_crtc *crtc, |
| 61 | struct drm_atomic_state *state); |
| 62 | void vmw_vkms_crtc_atomic_disable(struct drm_crtc *crtc, |
| 63 | struct drm_atomic_state *state); |
| 64 | |
| 65 | const char *const *vmw_vkms_get_crc_sources(struct drm_crtc *crtc, |
| 66 | size_t *count); |
| 67 | int vmw_vkms_verify_crc_source(struct drm_crtc *crtc, |
| 68 | const char *src_name, |
| 69 | size_t *values_cnt); |
| 70 | int vmw_vkms_set_crc_source(struct drm_crtc *crtc, |
| 71 | const char *src_name); |
| 72 | void vmw_vkms_set_crc_surface(struct drm_crtc *crtc, |
| 73 | struct vmw_surface *surf); |
| 74 | |
| 75 | #endif |
| 76 | |