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