18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: MIT */
28c2ecf20Sopenharmony_ci/* Copyright (C) 2006-2016 Oracle Corporation */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef __VBOXVIDEO_GUEST_H__
58c2ecf20Sopenharmony_ci#define __VBOXVIDEO_GUEST_H__
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#include <linux/genalloc.h>
88c2ecf20Sopenharmony_ci#include "vboxvideo.h"
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/*
118c2ecf20Sopenharmony_ci * Structure grouping the context needed for sending graphics acceleration
128c2ecf20Sopenharmony_ci * information to the host via VBVA.  Each screen has its own VBVA buffer.
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_cistruct vbva_buf_ctx {
158c2ecf20Sopenharmony_ci	/* Offset of the buffer in the VRAM section for the screen */
168c2ecf20Sopenharmony_ci	u32 buffer_offset;
178c2ecf20Sopenharmony_ci	/* Length of the buffer in bytes */
188c2ecf20Sopenharmony_ci	u32 buffer_length;
198c2ecf20Sopenharmony_ci	/* Set if we wrote to the buffer faster than the host could read it */
208c2ecf20Sopenharmony_ci	bool buffer_overflow;
218c2ecf20Sopenharmony_ci	/* VBVA record that we are currently preparing for the host, or NULL */
228c2ecf20Sopenharmony_ci	struct vbva_record *record;
238c2ecf20Sopenharmony_ci	/*
248c2ecf20Sopenharmony_ci	 * Pointer to the VBVA buffer mapped into the current address space.
258c2ecf20Sopenharmony_ci	 * Will be NULL if VBVA is not enabled.
268c2ecf20Sopenharmony_ci	 */
278c2ecf20Sopenharmony_ci	struct vbva_buffer *vbva;
288c2ecf20Sopenharmony_ci};
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciint hgsmi_report_flags_location(struct gen_pool *ctx, u32 location);
318c2ecf20Sopenharmony_ciint hgsmi_send_caps_info(struct gen_pool *ctx, u32 caps);
328c2ecf20Sopenharmony_ciint hgsmi_test_query_conf(struct gen_pool *ctx);
338c2ecf20Sopenharmony_ciint hgsmi_query_conf(struct gen_pool *ctx, u32 index, u32 *value_ret);
348c2ecf20Sopenharmony_ciint hgsmi_update_pointer_shape(struct gen_pool *ctx, u32 flags,
358c2ecf20Sopenharmony_ci			       u32 hot_x, u32 hot_y, u32 width, u32 height,
368c2ecf20Sopenharmony_ci			       u8 *pixels, u32 len);
378c2ecf20Sopenharmony_ciint hgsmi_cursor_position(struct gen_pool *ctx, bool report_position,
388c2ecf20Sopenharmony_ci			  u32 x, u32 y, u32 *x_host, u32 *y_host);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_cibool vbva_enable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
418c2ecf20Sopenharmony_ci		 struct vbva_buffer *vbva, s32 screen);
428c2ecf20Sopenharmony_civoid vbva_disable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
438c2ecf20Sopenharmony_ci		  s32 screen);
448c2ecf20Sopenharmony_cibool vbva_buffer_begin_update(struct vbva_buf_ctx *vbva_ctx,
458c2ecf20Sopenharmony_ci			      struct gen_pool *ctx);
468c2ecf20Sopenharmony_civoid vbva_buffer_end_update(struct vbva_buf_ctx *vbva_ctx);
478c2ecf20Sopenharmony_cibool vbva_write(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
488c2ecf20Sopenharmony_ci		const void *p, u32 len);
498c2ecf20Sopenharmony_civoid vbva_setup_buffer_context(struct vbva_buf_ctx *vbva_ctx,
508c2ecf20Sopenharmony_ci			       u32 buffer_offset, u32 buffer_length);
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_civoid hgsmi_process_display_info(struct gen_pool *ctx, u32 display,
538c2ecf20Sopenharmony_ci				s32 origin_x, s32 origin_y, u32 start_offset,
548c2ecf20Sopenharmony_ci				u32 pitch, u32 width, u32 height,
558c2ecf20Sopenharmony_ci				u16 bpp, u16 flags);
568c2ecf20Sopenharmony_ciint hgsmi_update_input_mapping(struct gen_pool *ctx, s32 origin_x, s32 origin_y,
578c2ecf20Sopenharmony_ci			       u32 width, u32 height);
588c2ecf20Sopenharmony_ciint hgsmi_get_mode_hints(struct gen_pool *ctx, unsigned int screens,
598c2ecf20Sopenharmony_ci			 struct vbva_modehint *hints);
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#endif
62