162306a36Sopenharmony_ci/* SPDX-License-Identifier: MIT */
262306a36Sopenharmony_ci/* Copyright (C) 2006-2016 Oracle Corporation */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifndef __VBOXVIDEO_GUEST_H__
562306a36Sopenharmony_ci#define __VBOXVIDEO_GUEST_H__
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#include <linux/genalloc.h>
862306a36Sopenharmony_ci#include "vboxvideo.h"
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci/*
1162306a36Sopenharmony_ci * Structure grouping the context needed for sending graphics acceleration
1262306a36Sopenharmony_ci * information to the host via VBVA.  Each screen has its own VBVA buffer.
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_cistruct vbva_buf_ctx {
1562306a36Sopenharmony_ci	/* Offset of the buffer in the VRAM section for the screen */
1662306a36Sopenharmony_ci	u32 buffer_offset;
1762306a36Sopenharmony_ci	/* Length of the buffer in bytes */
1862306a36Sopenharmony_ci	u32 buffer_length;
1962306a36Sopenharmony_ci	/* Set if we wrote to the buffer faster than the host could read it */
2062306a36Sopenharmony_ci	bool buffer_overflow;
2162306a36Sopenharmony_ci	/* VBVA record that we are currently preparing for the host, or NULL */
2262306a36Sopenharmony_ci	struct vbva_record *record;
2362306a36Sopenharmony_ci	/*
2462306a36Sopenharmony_ci	 * Pointer to the VBVA buffer mapped into the current address space.
2562306a36Sopenharmony_ci	 * Will be NULL if VBVA is not enabled.
2662306a36Sopenharmony_ci	 */
2762306a36Sopenharmony_ci	struct vbva_buffer *vbva;
2862306a36Sopenharmony_ci};
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciint hgsmi_report_flags_location(struct gen_pool *ctx, u32 location);
3162306a36Sopenharmony_ciint hgsmi_send_caps_info(struct gen_pool *ctx, u32 caps);
3262306a36Sopenharmony_ciint hgsmi_test_query_conf(struct gen_pool *ctx);
3362306a36Sopenharmony_ciint hgsmi_query_conf(struct gen_pool *ctx, u32 index, u32 *value_ret);
3462306a36Sopenharmony_ciint hgsmi_update_pointer_shape(struct gen_pool *ctx, u32 flags,
3562306a36Sopenharmony_ci			       u32 hot_x, u32 hot_y, u32 width, u32 height,
3662306a36Sopenharmony_ci			       u8 *pixels, u32 len);
3762306a36Sopenharmony_ciint hgsmi_cursor_position(struct gen_pool *ctx, bool report_position,
3862306a36Sopenharmony_ci			  u32 x, u32 y, u32 *x_host, u32 *y_host);
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_cibool vbva_enable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
4162306a36Sopenharmony_ci		 struct vbva_buffer *vbva, s32 screen);
4262306a36Sopenharmony_civoid vbva_disable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
4362306a36Sopenharmony_ci		  s32 screen);
4462306a36Sopenharmony_cibool vbva_buffer_begin_update(struct vbva_buf_ctx *vbva_ctx,
4562306a36Sopenharmony_ci			      struct gen_pool *ctx);
4662306a36Sopenharmony_civoid vbva_buffer_end_update(struct vbva_buf_ctx *vbva_ctx);
4762306a36Sopenharmony_cibool vbva_write(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
4862306a36Sopenharmony_ci		const void *p, u32 len);
4962306a36Sopenharmony_civoid vbva_setup_buffer_context(struct vbva_buf_ctx *vbva_ctx,
5062306a36Sopenharmony_ci			       u32 buffer_offset, u32 buffer_length);
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_civoid hgsmi_process_display_info(struct gen_pool *ctx, u32 display,
5362306a36Sopenharmony_ci				s32 origin_x, s32 origin_y, u32 start_offset,
5462306a36Sopenharmony_ci				u32 pitch, u32 width, u32 height,
5562306a36Sopenharmony_ci				u16 bpp, u16 flags);
5662306a36Sopenharmony_ciint hgsmi_update_input_mapping(struct gen_pool *ctx, s32 origin_x, s32 origin_y,
5762306a36Sopenharmony_ci			       u32 width, u32 height);
5862306a36Sopenharmony_ciint hgsmi_get_mode_hints(struct gen_pool *ctx, unsigned int screens,
5962306a36Sopenharmony_ci			 struct vbva_modehint *hints);
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#endif
62