xref: /linux/drivers/gpu/drm/hyperv/hyperv_drm.h (revision cb8fef4b07f71da01843457b66e579ad248a625e)
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 hv_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 mmio_megabytes;
33 	bool dirt_needed;
34 
35 	u8 init_buf[VMBUS_MAX_PACKET_SIZE];
36 	u8 recv_buf[VMBUS_MAX_PACKET_SIZE];
37 
38 	struct hv_device *hdev;
39 };
40 
41 #define to_hv_drm(_dev) container_of(_dev, struct hv_drm_device, dev)
42 
43 /* hyperv_drm_modeset */
44 int hv_drm_mode_config_init(struct hv_drm_device *hv);
45 
46 /* hyperv_drm_proto */
47 int hv_drm_update_vram_location(struct hv_device *hdev, phys_addr_t vram_pp);
48 int hv_drm_update_situation(struct hv_device *hdev, u8 active, u32 bpp,
49 			    u32 w, u32 h, u32 pitch);
50 int hv_drm_hide_hw_ptr(struct hv_device *hdev);
51 int hv_drm_update_dirt(struct hv_device *hdev, struct drm_rect *rect);
52 int hv_drm_connect_vsp(struct hv_device *hdev);
53 
54 #endif
55