xref: /linux/drivers/gpu/drm/hyperv/hyperv_drm.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
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_simple_display_pipe pipe;
15 	struct drm_connector connector;
16 
17 	/* mode */
18 	u32 screen_width_max;
19 	u32 screen_height_max;
20 	u32 preferred_width;
21 	u32 preferred_height;
22 	u32 screen_depth;
23 
24 	/* hw */
25 	struct resource *mem;
26 	void __iomem *vram;
27 	unsigned long fb_base;
28 	unsigned long fb_size;
29 	struct completion wait;
30 	u32 synthvid_version;
31 	u32 mmio_megabytes;
32 	bool dirt_needed;
33 
34 	u8 init_buf[VMBUS_MAX_PACKET_SIZE];
35 	u8 recv_buf[VMBUS_MAX_PACKET_SIZE];
36 
37 	struct hv_device *hdev;
38 };
39 
40 #define to_hv(_dev) container_of(_dev, struct hyperv_drm_device, dev)
41 
42 /* hyperv_drm_modeset */
43 int hyperv_mode_config_init(struct hyperv_drm_device *hv);
44 
45 /* hyperv_drm_proto */
46 int hyperv_update_vram_location(struct hv_device *hdev, phys_addr_t vram_pp);
47 int hyperv_update_situation(struct hv_device *hdev, u8 active, u32 bpp,
48 			    u32 w, u32 h, u32 pitch);
49 int hyperv_hide_hw_ptr(struct hv_device *hdev);
50 int hyperv_update_dirt(struct hv_device *hdev, struct drm_rect *rect);
51 int hyperv_connect_vsp(struct hv_device *hdev);
52 
53 #endif
54