This source file includes following definitions.
- hgsmi_process_display_info
- hgsmi_update_input_mapping
- hgsmi_get_mode_hints
1
2
3
4 #include <linux/vbox_err.h>
5 #include "vbox_drv.h"
6 #include "vboxvideo_guest.h"
7 #include "vboxvideo_vbe.h"
8 #include "hgsmi_channels.h"
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 void hgsmi_process_display_info(struct gen_pool *ctx, u32 display,
28 s32 origin_x, s32 origin_y, u32 start_offset,
29 u32 pitch, u32 width, u32 height,
30 u16 bpp, u16 flags)
31 {
32 struct vbva_infoscreen *p;
33
34 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA,
35 VBVA_INFO_SCREEN);
36 if (!p)
37 return;
38
39 p->view_index = display;
40 p->origin_x = origin_x;
41 p->origin_y = origin_y;
42 p->start_offset = start_offset;
43 p->line_size = pitch;
44 p->width = width;
45 p->height = height;
46 p->bits_per_pixel = bpp;
47 p->flags = flags;
48
49 hgsmi_buffer_submit(ctx, p);
50 hgsmi_buffer_free(ctx, p);
51 }
52
53
54
55
56
57
58
59
60
61
62
63
64
65 int hgsmi_update_input_mapping(struct gen_pool *ctx, s32 origin_x, s32 origin_y,
66 u32 width, u32 height)
67 {
68 struct vbva_report_input_mapping *p;
69
70 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA,
71 VBVA_REPORT_INPUT_MAPPING);
72 if (!p)
73 return -ENOMEM;
74
75 p->x = origin_x;
76 p->y = origin_y;
77 p->cx = width;
78 p->cy = height;
79
80 hgsmi_buffer_submit(ctx, p);
81 hgsmi_buffer_free(ctx, p);
82
83 return 0;
84 }
85
86
87
88
89
90
91
92
93 int hgsmi_get_mode_hints(struct gen_pool *ctx, unsigned int screens,
94 struct vbva_modehint *hints)
95 {
96 struct vbva_query_mode_hints *p;
97 size_t size;
98
99 if (WARN_ON(!hints))
100 return -EINVAL;
101
102 size = screens * sizeof(struct vbva_modehint);
103 p = hgsmi_buffer_alloc(ctx, sizeof(*p) + size, HGSMI_CH_VBVA,
104 VBVA_QUERY_MODE_HINTS);
105 if (!p)
106 return -ENOMEM;
107
108 p->hints_queried_count = screens;
109 p->hint_structure_guest_size = sizeof(struct vbva_modehint);
110 p->rc = VERR_NOT_SUPPORTED;
111
112 hgsmi_buffer_submit(ctx, p);
113
114 if (p->rc < 0) {
115 hgsmi_buffer_free(ctx, p);
116 return -EIO;
117 }
118
119 memcpy(hints, ((u8 *)p) + sizeof(struct vbva_query_mode_hints), size);
120 hgsmi_buffer_free(ctx, p);
121
122 return 0;
123 }