1f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/********************************************************** 2f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Copyright 2008-2009 VMware, Inc. All rights reserved. 3f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 4f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Permission is hereby granted, free of charge, to any person 5f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * obtaining a copy of this software and associated documentation 6f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * files (the "Software"), to deal in the Software without 7f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * restriction, including without limitation the rights to use, copy, 8f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * modify, merge, publish, distribute, sublicense, and/or sell copies 9f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * of the Software, and to permit persons to whom the Software is 10f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * furnished to do so, subject to the following conditions: 11f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 12f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * The above copyright notice and this permission notice shall be 13f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * included in all copies or substantial portions of the Software. 14f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 15f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SOFTWARE. 23f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 24f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org **********************************************************/ 25f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 26f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 27f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * @file 28f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * VMware SVGA specific winsys interface. 29f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 30f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * @author Jose Fonseca <jfonseca@vmware.com> 31f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 32f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Documentation taken from the VMware SVGA DDK. 33f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 34f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 35f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#ifndef SVGA_WINSYS_H_ 36f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SVGA_WINSYS_H_ 37f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 38f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 39f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "svga_types.h" 40f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "svga_reg.h" 41f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "svga3d_reg.h" 42f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 43f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_compiler.h" 44f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#include "pipe/p_defines.h" 45f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 46f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 47f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct svga_winsys_screen; 48f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct svga_winsys_buffer; 49f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pipe_screen; 50f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pipe_context; 51f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pipe_fence_handle; 52f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pipe_resource; 53f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct svga_region; 54f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct winsys_handle; 55f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 56f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 57f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SVGA_BUFFER_USAGE_PINNED (1 << 0) 58f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SVGA_BUFFER_USAGE_WRAPPED (1 << 1) 59f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 60f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 61f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SVGA_RELOC_WRITE 0x1 62f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SVGA_RELOC_READ 0x2 63f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 64f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SVGA_FENCE_FLAG_EXEC (1 << 0) 65f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#define SVGA_FENCE_FLAG_QUERY (1 << 1) 66f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 67f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** Opaque surface handle */ 68f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct svga_winsys_surface; 69f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 70f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 71f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 72f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SVGA per-context winsys interface. 73f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 74f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct svga_winsys_context 75f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 76f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void 77f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*destroy)(struct svga_winsys_context *swc); 78f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 79f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void * 80f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*reserve)(struct svga_winsys_context *swc, 81f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32_t nr_bytes, uint32_t nr_relocs ); 82f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 83f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 84f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Emit a relocation for a host surface. 85f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 86f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * @param flags bitmask of SVGA_RELOC_* flags 87f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 88f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * NOTE: Order of this call does matter. It should be the same order 89f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * as relocations appear in the command buffer. 90f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 91f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void 92f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*surface_relocation)(struct svga_winsys_context *swc, 93f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32 *sid, 94f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_surface *surface, 95f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned flags); 96f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 97f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 98f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Emit a relocation for a guest memory region. 99f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 100f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * @param flags bitmask of SVGA_RELOC_* flags 101f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 102f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * NOTE: Order of this call does matter. It should be the same order 103f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * as relocations appear in the command buffer. 104f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 105f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void 106f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*region_relocation)(struct svga_winsys_context *swc, 107f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct SVGAGuestPtr *ptr, 108f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_buffer *buffer, 109f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32 offset, 110f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned flags); 111f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 112f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void 113f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*commit)(struct svga_winsys_context *swc); 114f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 115f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org enum pipe_error 116f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*flush)(struct svga_winsys_context *swc, 117f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pipe_fence_handle **pfence); 118f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 119f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 120f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Context ID used to fill in the commands 121f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 122f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Context IDs are arbitrary small non-negative integers, 123f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * global to the entire SVGA device. 124f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 125f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32 cid; 126f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 127f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 128f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 129f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org/** 130f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SVGA per-screen winsys interface. 131f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 132f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct svga_winsys_screen 133f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org{ 134f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void 135f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*destroy)(struct svga_winsys_screen *sws); 136f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 137f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SVGA3dHardwareVersion 138f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*get_hw_version)(struct svga_winsys_screen *sws); 139f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 140f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org boolean 141f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*get_cap)(struct svga_winsys_screen *sws, 142f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SVGA3dDevCapIndex index, 143f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SVGA3dDevCapResult *result); 144f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 145f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 146f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Create a new context. 147f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 148f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Context objects encapsulate all render state, and shader 149f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * objects are per-context. 150f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 151f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Surfaces are not per-context. The same surface can be shared 152f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * between multiple contexts, and surface operations can occur 153f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * without a context. 154f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 155f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_context * 156f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*context_create)(struct svga_winsys_screen *sws); 157f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 158f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 159f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 160f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * This creates a "surface" object in the SVGA3D device, 161f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * and returns the surface ID (sid). Surfaces are generic 162f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * containers for host VRAM objects like textures, vertex 163f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * buffers, and depth/stencil buffers. 164f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 165f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Surfaces are hierarchial: 166f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 167f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * - Surface may have multiple faces (for cube maps) 168f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 169f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * - Each face has a list of mipmap levels 170f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 171f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * - Each mipmap image may have multiple volume 172f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * slices, if the image is three dimensional. 173f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 174f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * - Each slice is a 2D array of 'blocks' 175f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 176f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * - Each block may be one or more pixels. 177f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * (Usually 1, more for DXT or YUV formats.) 178f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 179f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Surfaces are generic host VRAM objects. The SVGA3D device 180f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * may optimize surfaces according to the format they were 181f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * created with, but this format does not limit the ways in 182f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * which the surface may be used. For example, a depth surface 183f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * can be used as a texture, or a floating point image may 184f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * be used as a vertex buffer. Some surface usages may be 185f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * lower performance, due to software emulation, but any 186f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * usage should work with any surface. 187f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 188f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_surface * 189f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*surface_create)(struct svga_winsys_screen *sws, 190f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SVGA3dSurfaceFlags flags, 191f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SVGA3dSurfaceFormat format, 192f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SVGA3dSize size, 193f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32 numFaces, 194f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org uint32 numMipLevels); 195f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 196f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 197f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Creates a surface from a winsys handle. 198f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Used to implement pipe_screen::resource_from_handle. 199f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 200f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_surface * 201f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*surface_from_handle)(struct svga_winsys_screen *sws, 202f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct winsys_handle *whandle, 203f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org SVGA3dSurfaceFormat *format); 204f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 205f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 206f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Get a winsys_handle from a surface. 207f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Used to implement pipe_screen::resource_get_handle. 208f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 209f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org boolean 210f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*surface_get_handle)(struct svga_winsys_screen *sws, 211f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_surface *surface, 212f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned stride, 213f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct winsys_handle *whandle); 214f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 215f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 216f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Whether this surface is sitting in a validate list 217f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 218f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org boolean 219f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*surface_is_flushed)(struct svga_winsys_screen *sws, 220f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_surface *surface); 221f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 222f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 223f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Reference a SVGA3D surface object. This allows sharing of a 224f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * surface between different objects. 225f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 226f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void 227f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*surface_reference)(struct svga_winsys_screen *sws, 228f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_surface **pdst, 229f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_surface *src); 230f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 231f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 232f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Buffer management. Buffer attributes are mostly fixed over its lifetime. 233f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 234f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * @param usage bitmask of SVGA_BUFFER_USAGE_* flags. 235f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * 236f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * alignment indicates the client's alignment requirements, eg for 237f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * SSE instructions. 238f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 239f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_buffer * 240f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*buffer_create)( struct svga_winsys_screen *sws, 241f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned alignment, 242f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned usage, 243f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned size ); 244f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 245f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 246f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Map the entire data store of a buffer object into the client's address. 247f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * usage is a bitmask of PIPE_TRANSFER_* 248f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 249f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void * 250f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*buffer_map)( struct svga_winsys_screen *sws, 251f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_buffer *buf, 252f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned usage ); 253f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 254f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void 255f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*buffer_unmap)( struct svga_winsys_screen *sws, 256f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_buffer *buf ); 257f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 258f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void 259f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*buffer_destroy)( struct svga_winsys_screen *sws, 260f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_buffer *buf ); 261f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 262f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 263f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 264f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Reference a fence object. 265f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 266f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org void 267f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org (*fence_reference)( struct svga_winsys_screen *sws, 268f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pipe_fence_handle **pdst, 269f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pipe_fence_handle *src ); 270f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 271f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 272f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Checks whether the fence has been signalled. 273f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \param flags driver-specific meaning 274f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \return zero on success. 275f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 276f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int (*fence_signalled)( struct svga_winsys_screen *sws, 277f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pipe_fence_handle *fence, 278f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned flag ); 279f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 280f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org /** 281f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * Wait for the fence to finish. 282f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \param flags driver-specific meaning 283f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org * \return zero on success. 284f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org */ 285f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org int (*fence_finish)( struct svga_winsys_screen *sws, 286f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct pipe_fence_handle *fence, 287f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org unsigned flag ); 288f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 289f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org}; 290f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 291f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 292f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct svga_winsys_screen * 293f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgsvga_winsys_screen(struct pipe_screen *screen); 294f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 295f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct svga_winsys_context * 296f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgsvga_winsys_context(struct pipe_context *context); 297f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 298f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct pipe_resource * 299f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgsvga_screen_buffer_wrap_surface(struct pipe_screen *screen, 300f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org enum SVGA3dSurfaceFormat format, 301f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org struct svga_winsys_surface *srf); 302f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 303f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgstruct svga_winsys_surface * 304f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.orgsvga_screen_buffer_get_winsys_surface(struct pipe_resource *buffer); 305f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org 306f2ba7591b1407a7ee9209f842c50696914dc2dedkbr@chromium.org#endif /* SVGA_WINSYS_H_ */ 307