Path: blob/21.2-virgl/src/gallium/include/frontend/sw_winsys.h
4565 views
/**************************************************************************1*2* Copyright 2007-2009 VMware, Inc.3* All Rights Reserved.4*5* Permission is hereby granted, free of charge, to any person obtaining a6* copy of this software and associated documentation files (the7* "Software"), to deal in the Software without restriction, including8* without limitation the rights to use, copy, modify, merge, publish,9* distribute, sub license, and/or sell copies of the Software, and to10* permit persons to whom the Software is furnished to do so, subject to11* the following conditions:12*13* The above copyright notice and this permission notice (including the14* next paragraph) shall be included in all copies or substantial portions15* of the Software.16*17* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS18* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF19* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.20* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR21* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,22* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE23* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.24*25**************************************************************************/2627/**28* @file29* Software rasterizer winsys.30*/313233#ifndef SW_WINSYS_H34#define SW_WINSYS_H353637#include "pipe/p_format.h"38#include "frontend/winsys_handle.h"3940#ifdef __cplusplus41extern "C" {42#endif434445struct pipe_screen;46struct pipe_context;47struct pipe_resource;48struct pipe_box;4950/**51* Opaque pointer.52*/53struct sw_displaytarget;545556/**57* This is the interface that sw expects any window system58* hosting it to implement.59*60* sw is for the most part a self sufficient driver. The only thing it61* does not know is how to display a surface.62*/63struct sw_winsys64{65void66(*destroy)( struct sw_winsys *ws );6768bool69(*is_displaytarget_format_supported)( struct sw_winsys *ws,70unsigned tex_usage,71enum pipe_format format );7273/**74* Allocate storage for a render target.75*76* Often surfaces which are meant to be blitted to the front screen (i.e.,77* display targets) must be allocated with special characteristics, memory78* pools, or obtained directly from the windowing system.79*80* This callback is invoked by the pipe_screen when creating a texture marked81* with the PIPE_BIND_DISPLAY_TARGET flag to get the underlying82* storage.83*/84struct sw_displaytarget *85(*displaytarget_create)( struct sw_winsys *ws,86unsigned tex_usage,87enum pipe_format format,88unsigned width, unsigned height,89unsigned alignment,90const void *front_private,91unsigned *stride );9293/**94* Used to implement texture_from_handle.95*/96struct sw_displaytarget *97(*displaytarget_from_handle)( struct sw_winsys *ws,98const struct pipe_resource *templat,99struct winsys_handle *whandle,100unsigned *stride );101102/**103* Used to implement texture_get_handle.104*/105bool106(*displaytarget_get_handle)( struct sw_winsys *ws,107struct sw_displaytarget *dt,108struct winsys_handle *whandle );109110/**111* \param flags bitmask of PIPE_MAP_x flags112*/113void *114(*displaytarget_map)( struct sw_winsys *ws,115struct sw_displaytarget *dt,116unsigned flags );117118void119(*displaytarget_unmap)( struct sw_winsys *ws,120struct sw_displaytarget *dt );121122/**123* @sa pipe_screen:flush_frontbuffer.124*125* This call will likely become asynchronous eventually.126*/127void128(*displaytarget_display)( struct sw_winsys *ws,129struct sw_displaytarget *dt,130void *context_private,131struct pipe_box *box );132133void134(*displaytarget_destroy)( struct sw_winsys *ws,135struct sw_displaytarget *dt );136};137138139140#ifdef __cplusplus141}142#endif143144#endif /* SW_WINSYS_H */145146147