Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.15 146 lines 3.7 kB view raw
1/* SPDX-License-Identifier: GPL-2.0+ */ 2 3#ifndef _VKMS_DRV_H_ 4#define _VKMS_DRV_H_ 5 6#include <linux/hrtimer.h> 7 8#include <drm/drm.h> 9#include <drm/drm_gem.h> 10#include <drm/drm_gem_atomic_helper.h> 11#include <drm/drm_encoder.h> 12#include <drm/drm_writeback.h> 13 14#define XRES_MIN 20 15#define YRES_MIN 20 16 17#define XRES_DEF 1024 18#define YRES_DEF 768 19 20#define XRES_MAX 8192 21#define YRES_MAX 8192 22 23struct vkms_writeback_job { 24 struct dma_buf_map map[DRM_FORMAT_MAX_PLANES]; 25 struct dma_buf_map data[DRM_FORMAT_MAX_PLANES]; 26}; 27 28struct vkms_composer { 29 struct drm_framebuffer fb; 30 struct drm_rect src, dst; 31 struct dma_buf_map map[4]; 32 unsigned int offset; 33 unsigned int pitch; 34 unsigned int cpp; 35}; 36 37/** 38 * vkms_plane_state - Driver specific plane state 39 * @base: base plane state 40 * @composer: data required for composing computation 41 */ 42struct vkms_plane_state { 43 struct drm_shadow_plane_state base; 44 struct vkms_composer *composer; 45}; 46 47struct vkms_plane { 48 struct drm_plane base; 49}; 50 51/** 52 * vkms_crtc_state - Driver specific CRTC state 53 * @base: base CRTC state 54 * @composer_work: work struct to compose and add CRC entries 55 * @n_frame_start: start frame number for computed CRC 56 * @n_frame_end: end frame number for computed CRC 57 */ 58struct vkms_crtc_state { 59 struct drm_crtc_state base; 60 struct work_struct composer_work; 61 62 int num_active_planes; 63 /* stack of active planes for crc computation, should be in z order */ 64 struct vkms_plane_state **active_planes; 65 struct vkms_writeback_job *active_writeback; 66 67 /* below four are protected by vkms_output.composer_lock */ 68 bool crc_pending; 69 bool wb_pending; 70 u64 frame_start; 71 u64 frame_end; 72}; 73 74struct vkms_output { 75 struct drm_crtc crtc; 76 struct drm_encoder encoder; 77 struct drm_connector connector; 78 struct drm_writeback_connector wb_connector; 79 struct hrtimer vblank_hrtimer; 80 ktime_t period_ns; 81 struct drm_pending_vblank_event *event; 82 /* ordered wq for composer_work */ 83 struct workqueue_struct *composer_workq; 84 /* protects concurrent access to composer */ 85 spinlock_t lock; 86 87 /* protected by @lock */ 88 bool composer_enabled; 89 struct vkms_crtc_state *composer_state; 90 91 spinlock_t composer_lock; 92}; 93 94struct vkms_device; 95 96struct vkms_config { 97 bool writeback; 98 bool cursor; 99 bool overlay; 100 /* only set when instantiated */ 101 struct vkms_device *dev; 102}; 103 104struct vkms_device { 105 struct drm_device drm; 106 struct platform_device *platform; 107 struct vkms_output output; 108 const struct vkms_config *config; 109}; 110 111#define drm_crtc_to_vkms_output(target) \ 112 container_of(target, struct vkms_output, crtc) 113 114#define drm_device_to_vkms_device(target) \ 115 container_of(target, struct vkms_device, drm) 116 117#define to_vkms_crtc_state(target)\ 118 container_of(target, struct vkms_crtc_state, base) 119 120#define to_vkms_plane_state(target)\ 121 container_of(target, struct vkms_plane_state, base.base) 122 123/* CRTC */ 124int vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, 125 struct drm_plane *primary, struct drm_plane *cursor); 126 127int vkms_output_init(struct vkms_device *vkmsdev, int index); 128 129struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev, 130 enum drm_plane_type type, int index); 131 132/* CRC Support */ 133const char *const *vkms_get_crc_sources(struct drm_crtc *crtc, 134 size_t *count); 135int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name); 136int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name, 137 size_t *values_cnt); 138 139/* Composer Support */ 140void vkms_composer_worker(struct work_struct *work); 141void vkms_set_composer(struct vkms_output *out, bool enabled); 142 143/* Writeback */ 144int vkms_enable_writeback_connector(struct vkms_device *vkmsdev); 145 146#endif /* _VKMS_DRV_H_ */