1bf215546Sopenharmony_ci/********************************************************** 2bf215546Sopenharmony_ci * Copyright 2009-2015 VMware, Inc. All rights reserved. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person 5bf215546Sopenharmony_ci * obtaining a copy of this software and associated documentation 6bf215546Sopenharmony_ci * files (the "Software"), to deal in the Software without 7bf215546Sopenharmony_ci * restriction, including without limitation the rights to use, copy, 8bf215546Sopenharmony_ci * modify, merge, publish, distribute, sublicense, and/or sell copies 9bf215546Sopenharmony_ci * of the Software, and to permit persons to whom the Software is 10bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions: 11bf215546Sopenharmony_ci * 12bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be 13bf215546Sopenharmony_ci * included in all copies or substantial portions of the Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16bf215546Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18bf215546Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 19bf215546Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 20bf215546Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 21bf215546Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22bf215546Sopenharmony_ci * SOFTWARE. 23bf215546Sopenharmony_ci * 24bf215546Sopenharmony_ci **********************************************************/ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#ifndef VMW_BUFFER_H_ 28bf215546Sopenharmony_ci#define VMW_BUFFER_H_ 29bf215546Sopenharmony_ci 30bf215546Sopenharmony_ci#include <assert.h> 31bf215546Sopenharmony_ci#include "pipe/p_compiler.h" 32bf215546Sopenharmony_ci#include "pipebuffer/pb_bufmgr.h" 33bf215546Sopenharmony_ci#include "util/u_debug_flush.h" 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_ci/* These extra flags are used wherever the pb_usage_flags enum type is used */ 37bf215546Sopenharmony_ci#define VMW_BUFFER_USAGE_SHARED (1 << 14) 38bf215546Sopenharmony_ci#define VMW_BUFFER_USAGE_SYNC (1 << 15) 39bf215546Sopenharmony_ci 40bf215546Sopenharmony_cistruct SVGAGuestPtr; 41bf215546Sopenharmony_cistruct pb_buffer; 42bf215546Sopenharmony_cistruct pb_manager; 43bf215546Sopenharmony_cistruct svga_winsys_buffer; 44bf215546Sopenharmony_cistruct svga_winsys_surface; 45bf215546Sopenharmony_cistruct vmw_winsys_screen; 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_cistruct vmw_buffer_desc { 48bf215546Sopenharmony_ci struct pb_desc pb_desc; 49bf215546Sopenharmony_ci struct vmw_region *region; 50bf215546Sopenharmony_ci}; 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_ci 53bf215546Sopenharmony_ci#ifdef DEBUG 54bf215546Sopenharmony_ci 55bf215546Sopenharmony_cistruct pb_buffer * 56bf215546Sopenharmony_civmw_pb_buffer(struct svga_winsys_buffer *buffer); 57bf215546Sopenharmony_cistruct svga_winsys_buffer * 58bf215546Sopenharmony_civmw_svga_winsys_buffer_wrap(struct pb_buffer *buffer); 59bf215546Sopenharmony_cistruct debug_flush_buf * 60bf215546Sopenharmony_civmw_debug_flush_buf(struct svga_winsys_buffer *buffer); 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ci#else 63bf215546Sopenharmony_cistatic inline struct pb_buffer * 64bf215546Sopenharmony_civmw_pb_buffer(struct svga_winsys_buffer *buffer) 65bf215546Sopenharmony_ci{ 66bf215546Sopenharmony_ci assert(buffer); 67bf215546Sopenharmony_ci return (struct pb_buffer *)buffer; 68bf215546Sopenharmony_ci} 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_ci 71bf215546Sopenharmony_cistatic inline struct svga_winsys_buffer * 72bf215546Sopenharmony_civmw_svga_winsys_buffer_wrap(struct pb_buffer *buffer) 73bf215546Sopenharmony_ci{ 74bf215546Sopenharmony_ci return (struct svga_winsys_buffer *)buffer; 75bf215546Sopenharmony_ci} 76bf215546Sopenharmony_ci#endif 77bf215546Sopenharmony_ci 78bf215546Sopenharmony_civoid 79bf215546Sopenharmony_civmw_svga_winsys_buffer_destroy(struct svga_winsys_screen *sws, 80bf215546Sopenharmony_ci struct svga_winsys_buffer *buf); 81bf215546Sopenharmony_civoid * 82bf215546Sopenharmony_civmw_svga_winsys_buffer_map(struct svga_winsys_screen *sws, 83bf215546Sopenharmony_ci struct svga_winsys_buffer *buf, 84bf215546Sopenharmony_ci unsigned flags); 85bf215546Sopenharmony_ci 86bf215546Sopenharmony_civoid 87bf215546Sopenharmony_civmw_svga_winsys_buffer_unmap(struct svga_winsys_screen *sws, 88bf215546Sopenharmony_ci struct svga_winsys_buffer *buf); 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_cistruct pb_manager * 91bf215546Sopenharmony_civmw_gmr_bufmgr_create(struct vmw_winsys_screen *vws); 92bf215546Sopenharmony_ci 93bf215546Sopenharmony_ciboolean 94bf215546Sopenharmony_civmw_gmr_bufmgr_region_ptr(struct pb_buffer *buf, 95bf215546Sopenharmony_ci struct SVGAGuestPtr *ptr); 96bf215546Sopenharmony_ci 97bf215546Sopenharmony_ci 98bf215546Sopenharmony_ci#endif /* VMW_BUFFER_H_ */ 99