1 /* $NetBSD: vboxvideo_guest.h,v 1.2 2021/12/18 23:45:44 riastradh Exp $ */ 2 3 /* SPDX-License-Identifier: MIT */ 4 /* Copyright (C) 2006-2016 Oracle Corporation */ 5 6 #ifndef __VBOXVIDEO_GUEST_H__ 7 #define __VBOXVIDEO_GUEST_H__ 8 9 #include <linux/genalloc.h> 10 #include "vboxvideo.h" 11 12 /* 13 * Structure grouping the context needed for sending graphics acceleration 14 * information to the host via VBVA. Each screen has its own VBVA buffer. 15 */ 16 struct vbva_buf_ctx { 17 /* Offset of the buffer in the VRAM section for the screen */ 18 u32 buffer_offset; 19 /* Length of the buffer in bytes */ 20 u32 buffer_length; 21 /* Set if we wrote to the buffer faster than the host could read it */ 22 bool buffer_overflow; 23 /* VBVA record that we are currently preparing for the host, or NULL */ 24 struct vbva_record *record; 25 /* 26 * Pointer to the VBVA buffer mapped into the current address space. 27 * Will be NULL if VBVA is not enabled. 28 */ 29 struct vbva_buffer *vbva; 30 }; 31 32 int hgsmi_report_flags_location(struct gen_pool *ctx, u32 location); 33 int hgsmi_send_caps_info(struct gen_pool *ctx, u32 caps); 34 int hgsmi_test_query_conf(struct gen_pool *ctx); 35 int hgsmi_query_conf(struct gen_pool *ctx, u32 index, u32 *value_ret); 36 int hgsmi_update_pointer_shape(struct gen_pool *ctx, u32 flags, 37 u32 hot_x, u32 hot_y, u32 width, u32 height, 38 u8 *pixels, u32 len); 39 int hgsmi_cursor_position(struct gen_pool *ctx, bool report_position, 40 u32 x, u32 y, u32 *x_host, u32 *y_host); 41 42 bool vbva_enable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx, 43 struct vbva_buffer *vbva, s32 screen); 44 void vbva_disable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx, 45 s32 screen); 46 bool vbva_buffer_begin_update(struct vbva_buf_ctx *vbva_ctx, 47 struct gen_pool *ctx); 48 void vbva_buffer_end_update(struct vbva_buf_ctx *vbva_ctx); 49 bool vbva_write(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx, 50 const void *p, u32 len); 51 void vbva_setup_buffer_context(struct vbva_buf_ctx *vbva_ctx, 52 u32 buffer_offset, u32 buffer_length); 53 54 void hgsmi_process_display_info(struct gen_pool *ctx, u32 display, 55 s32 origin_x, s32 origin_y, u32 start_offset, 56 u32 pitch, u32 width, u32 height, 57 u16 bpp, u16 flags); 58 int hgsmi_update_input_mapping(struct gen_pool *ctx, s32 origin_x, s32 origin_y, 59 u32 width, u32 height); 60 int hgsmi_get_mode_hints(struct gen_pool *ctx, unsigned int screens, 61 struct vbva_modehint *hints); 62 63 #endif 64