linux/drivers/staging/vboxvideo/vboxvideo_guest.h
<<
>>
Prefs
   1/*
   2 * Copyright (C) 2006-2017 Oracle Corporation
   3 *
   4 * Permission is hereby granted, free of charge, to any person obtaining a
   5 * copy of this software and associated documentation files (the "Software"),
   6 * to deal in the Software without restriction, including without limitation
   7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   8 * and/or sell copies of the Software, and to permit persons to whom the
   9 * Software is furnished to do so, subject to the following conditions:
  10 *
  11 * The above copyright notice and this permission notice shall be included in
  12 * all copies or substantial portions of the Software.
  13 *
  14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20 * OTHER DEALINGS IN THE SOFTWARE.
  21 */
  22
  23#ifndef __VBOXVIDEO_GUEST_H__
  24#define __VBOXVIDEO_GUEST_H__
  25
  26#include <linux/genalloc.h>
  27#include "vboxvideo.h"
  28
  29/**
  30 * Structure grouping the context needed for sending graphics acceleration
  31 * information to the host via VBVA.  Each screen has its own VBVA buffer.
  32 */
  33struct vbva_buf_ctx {
  34        /** Offset of the buffer in the VRAM section for the screen */
  35        u32 buffer_offset;
  36        /** Length of the buffer in bytes */
  37        u32 buffer_length;
  38        /** Set if we wrote to the buffer faster than the host could read it */
  39        bool buffer_overflow;
  40        /** VBVA record that we are currently preparing for the host, or NULL */
  41        struct vbva_record *record;
  42        /**
  43         * Pointer to the VBVA buffer mapped into the current address space.
  44         * Will be NULL if VBVA is not enabled.
  45         */
  46        struct vbva_buffer *vbva;
  47};
  48
  49/**
  50 * @name Base HGSMI APIs
  51 * @{
  52 */
  53int hgsmi_report_flags_location(struct gen_pool *ctx, u32 location);
  54int hgsmi_send_caps_info(struct gen_pool *ctx, u32 caps);
  55int hgsmi_test_query_conf(struct gen_pool *ctx);
  56int hgsmi_query_conf(struct gen_pool *ctx, u32 index, u32 *value_ret);
  57int hgsmi_update_pointer_shape(struct gen_pool *ctx, u32 flags,
  58                               u32 hot_x, u32 hot_y, u32 width, u32 height,
  59                               u8 *pixels, u32 len);
  60int hgsmi_cursor_position(struct gen_pool *ctx, bool report_position,
  61                          u32 x, u32 y, u32 *x_host, u32 *y_host);
  62/** @}  */
  63
  64/**
  65 * @name VBVA APIs
  66 * @{
  67 */
  68bool vbva_enable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
  69                 struct vbva_buffer *vbva, s32 screen);
  70void vbva_disable(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
  71                  s32 screen);
  72bool vbva_buffer_begin_update(struct vbva_buf_ctx *vbva_ctx,
  73                              struct gen_pool *ctx);
  74void vbva_buffer_end_update(struct vbva_buf_ctx *vbva_ctx);
  75bool vbva_write(struct vbva_buf_ctx *vbva_ctx, struct gen_pool *ctx,
  76                const void *p, u32 len);
  77void vbva_setup_buffer_context(struct vbva_buf_ctx *vbva_ctx,
  78                               u32 buffer_offset, u32 buffer_length);
  79/** @}  */
  80
  81/**
  82 * @name Modesetting APIs
  83 * @{
  84 */
  85void hgsmi_process_display_info(struct gen_pool *ctx, u32 display,
  86                                s32 origin_x, s32 origin_y, u32 start_offset,
  87                                u32 pitch, u32 width, u32 height,
  88                                u16 bpp, u16 flags);
  89int hgsmi_update_input_mapping(struct gen_pool *ctx, s32 origin_x, s32 origin_y,
  90                               u32 width, u32 height);
  91int hgsmi_get_mode_hints(struct gen_pool *ctx, unsigned int screens,
  92                         struct vbva_modehint *hints);
  93/** @}  */
  94
  95#endif
  96