0001
0002
0003
0004 #include <linux/vbox_err.h>
0005 #include "vbox_drv.h"
0006 #include "vboxvideo_guest.h"
0007 #include "vboxvideo_vbe.h"
0008 #include "hgsmi_channels.h"
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 void hgsmi_process_display_info(struct gen_pool *ctx, u32 display,
0030 s32 origin_x, s32 origin_y, u32 start_offset,
0031 u32 pitch, u32 width, u32 height,
0032 u16 bpp, u16 flags)
0033 {
0034 struct vbva_infoscreen *p;
0035
0036 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA,
0037 VBVA_INFO_SCREEN);
0038 if (!p)
0039 return;
0040
0041 p->view_index = display;
0042 p->origin_x = origin_x;
0043 p->origin_y = origin_y;
0044 p->start_offset = start_offset;
0045 p->line_size = pitch;
0046 p->width = width;
0047 p->height = height;
0048 p->bits_per_pixel = bpp;
0049 p->flags = flags;
0050
0051 hgsmi_buffer_submit(ctx, p);
0052 hgsmi_buffer_free(ctx, p);
0053 }
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 int hgsmi_update_input_mapping(struct gen_pool *ctx, s32 origin_x, s32 origin_y,
0070 u32 width, u32 height)
0071 {
0072 struct vbva_report_input_mapping *p;
0073
0074 p = hgsmi_buffer_alloc(ctx, sizeof(*p), HGSMI_CH_VBVA,
0075 VBVA_REPORT_INPUT_MAPPING);
0076 if (!p)
0077 return -ENOMEM;
0078
0079 p->x = origin_x;
0080 p->y = origin_y;
0081 p->cx = width;
0082 p->cy = height;
0083
0084 hgsmi_buffer_submit(ctx, p);
0085 hgsmi_buffer_free(ctx, p);
0086
0087 return 0;
0088 }
0089
0090
0091
0092
0093
0094
0095
0096
0097 int hgsmi_get_mode_hints(struct gen_pool *ctx, unsigned int screens,
0098 struct vbva_modehint *hints)
0099 {
0100 struct vbva_query_mode_hints *p;
0101 size_t size;
0102
0103 if (WARN_ON(!hints))
0104 return -EINVAL;
0105
0106 size = screens * sizeof(struct vbva_modehint);
0107 p = hgsmi_buffer_alloc(ctx, sizeof(*p) + size, HGSMI_CH_VBVA,
0108 VBVA_QUERY_MODE_HINTS);
0109 if (!p)
0110 return -ENOMEM;
0111
0112 p->hints_queried_count = screens;
0113 p->hint_structure_guest_size = sizeof(struct vbva_modehint);
0114 p->rc = VERR_NOT_SUPPORTED;
0115
0116 hgsmi_buffer_submit(ctx, p);
0117
0118 if (p->rc < 0) {
0119 hgsmi_buffer_free(ctx, p);
0120 return -EIO;
0121 }
0122
0123 memcpy(hints, ((u8 *)p) + sizeof(struct vbva_query_mode_hints), size);
0124 hgsmi_buffer_free(ctx, p);
0125
0126 return 0;
0127 }