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