xref: /linux/drivers/gpu/drm/hyperv/hyperv_drm.h (revision 22c55fb9eb92395d999b8404d73e58540d11bdd8)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright 2021 Microsoft
4  */
5 
6 #ifndef _HYPERV_DRM_H_
7 #define _HYPERV_DRM_H_
8 
9 #define VMBUS_MAX_PACKET_SIZE 0x4000
10 
11 struct hyperv_drm_device {
12 	/* drm */
13 	struct drm_device dev;
14 	struct drm_plane plane;
15 	struct drm_crtc crtc;
16 	struct drm_encoder encoder;
17 	struct drm_connector connector;
18 
19 	/* mode */
20 	u32 screen_width_max;
21 	u32 screen_height_max;
22 	u32 preferred_width;
23 	u32 preferred_height;
24 	u32 screen_depth;
25 
26 	/* hw */
27 	struct resource *mem;
28 	void __iomem *vram;
29 	unsigned long fb_base;
30 	unsigned long fb_size;
31 	struct completion wait;
32 	u32 synthvid_version;
33 	u32 mmio_megabytes;
34 	bool dirt_needed;
35 
36 	u8 init_buf[VMBUS_MAX_PACKET_SIZE];
37 	u8 recv_buf[VMBUS_MAX_PACKET_SIZE];
38 
39 	struct hv_device *hdev;
40 };
41 
42 #define to_hv(_dev) container_of(_dev, struct hyperv_drm_device, dev)
43 
44 /* hyperv_drm_modeset */
45 int hyperv_mode_config_init(struct hyperv_drm_device *hv);
46 
47 /* hyperv_drm_proto */
48 int hyperv_update_vram_location(struct hv_device *hdev, phys_addr_t vram_pp);
49 int hyperv_update_situation(struct hv_device *hdev, u8 active, u32 bpp,
50 			    u32 w, u32 h, u32 pitch);
51 int hyperv_hide_hw_ptr(struct hv_device *hdev);
52 int hyperv_update_dirt(struct hv_device *hdev, struct drm_rect *rect);
53 int hyperv_connect_vsp(struct hv_device *hdev);
54 
55 #endif
56