native_helper.h revision 8b145e23023927ddec7839a9e4498d5a42e3ca29
1/* 2 * Mesa 3-D graphics library 3 * Version: 7.9 4 * 5 * Copyright (C) 2010 LunarG Inc. 6 * Copyright (C) 2011 VMware Inc. All rights reserved. 7 * 8 * Permission is hereby granted, free of charge, to any person obtaining a 9 * copy of this software and associated documentation files (the "Software"), 10 * to deal in the Software without restriction, including without limitation 11 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12 * and/or sell copies of the Software, and to permit persons to whom the 13 * Software is furnished to do so, subject to the following conditions: 14 * 15 * The above copyright notice and this permission notice shall be included 16 * in all copies or substantial portions of the Software. 17 * 18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 21 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 * DEALINGS IN THE SOFTWARE. 25 * 26 * Authors: 27 * Chia-I Wu <olv@lunarg.com> 28 * Thomas Hellstrom <thellstrom@vmware.com> 29 */ 30 31#include "native.h" 32 33struct resource_surface; 34struct sw_winsys; 35 36struct resource_surface * 37resource_surface_create(struct pipe_screen *screen, 38 enum pipe_format format, uint bind); 39 40void 41resource_surface_destroy(struct resource_surface *rsurf); 42 43boolean 44resource_surface_set_size(struct resource_surface *rsurf, 45 uint width, uint height); 46 47void 48resource_surface_get_size(struct resource_surface *rsurf, 49 uint *width, uint *height); 50 51boolean 52resource_surface_add_resources(struct resource_surface *rsurf, 53 uint resource_mask); 54 55void 56resource_surface_import_resource(struct resource_surface *rsurf, 57 enum native_attachment which, 58 struct pipe_resource *pres); 59 60void 61resource_surface_get_resources(struct resource_surface *rsurf, 62 struct pipe_resource **resources, 63 uint resource_mask); 64 65struct pipe_resource * 66resource_surface_get_single_resource(struct resource_surface *rsurf, 67 enum native_attachment which); 68 69void 70resource_surface_swap_buffers(struct resource_surface *rsurf, 71 enum native_attachment buf1, 72 enum native_attachment buf2, 73 boolean only_if_exist); 74 75boolean 76resource_surface_present(struct resource_surface *rsurf, 77 enum native_attachment which, 78 void *winsys_drawable_handle); 79 80/** 81 * Perform a gallium copy blit between the back left and front left 82 * surfaces. Needs to be followed by a call to resource_surface_flush. 83 */ 84boolean 85resource_surface_copy_swap(struct resource_surface *rsurf, 86 struct native_display *ndpy); 87 88/** 89 * Throttle on outstanding rendering using the copy context. For example 90 * copy swaps. 91 */ 92boolean 93resource_surface_throttle(struct resource_surface *rsurf); 94 95/** 96 * Flush pending rendering using the copy context. This function saves a 97 * marker for upcoming throttles. 98 */ 99boolean 100resource_surface_flush(struct resource_surface *rsurf, 101 struct native_display *ndpy); 102/** 103 * Wait for all rendering using the copy context to be complete. Frees all 104 * throttle markers saved using resource_surface_flush. 105 */ 106void 107resource_surface_wait(struct resource_surface *rsurf); 108