11b5d61b8Smrg/* 21b5d61b8Smrg * Copyright (c) 2016, NVIDIA CORPORATION. 31b5d61b8Smrg * 41b5d61b8Smrg * Permission is hereby granted, free of charge, to any person obtaining a 51b5d61b8Smrg * copy of this software and/or associated documentation files (the 61b5d61b8Smrg * "Materials"), to deal in the Materials without restriction, including 71b5d61b8Smrg * without limitation the rights to use, copy, modify, merge, publish, 81b5d61b8Smrg * distribute, sublicense, and/or sell copies of the Materials, and to 91b5d61b8Smrg * permit persons to whom the Materials are furnished to do so, subject to 101b5d61b8Smrg * the following conditions: 111b5d61b8Smrg * 121b5d61b8Smrg * The above copyright notice and this permission notice shall be included 131b5d61b8Smrg * unaltered in all copies or substantial portions of the Materials. 141b5d61b8Smrg * Any additions, deletions, or changes to the original source files 151b5d61b8Smrg * must be clearly indicated in accompanying documentation. 161b5d61b8Smrg * 171b5d61b8Smrg * If only executable code is distributed, then the accompanying 181b5d61b8Smrg * documentation must state that "this software is based in part on the 191b5d61b8Smrg * work of the Khronos Group." 201b5d61b8Smrg * 211b5d61b8Smrg * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 221b5d61b8Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 231b5d61b8Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 241b5d61b8Smrg * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 251b5d61b8Smrg * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 261b5d61b8Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 271b5d61b8Smrg * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 281b5d61b8Smrg */ 291b5d61b8Smrg 301b5d61b8Smrg#ifndef VNDSERVER_H 311b5d61b8Smrg#define VNDSERVER_H 321b5d61b8Smrg 331b5d61b8Smrg#include <dix-config.h> 341b5d61b8Smrg#include "glxvndabi.h" 351b5d61b8Smrg 361b5d61b8Smrg#define GLXContextID CARD32 371b5d61b8Smrg#define GLXDrawable CARD32 381b5d61b8Smrg 391b5d61b8Smrg#if defined(__cplusplus) 401b5d61b8Smrgextern "C" { 411b5d61b8Smrg#endif 421b5d61b8Smrg 431b5d61b8Smrgtypedef struct GlxScreenPrivRec { 441b5d61b8Smrg GlxServerVendor *vendor; 451b5d61b8Smrg} GlxScreenPriv; 461b5d61b8Smrg 471b5d61b8Smrgtypedef struct GlxContextTagInfoRec { 481b5d61b8Smrg GLXContextTag tag; 491b5d61b8Smrg ClientPtr client; 501b5d61b8Smrg GlxServerVendor *vendor; 511b5d61b8Smrg void *data; 521b5d61b8Smrg GLXContextID context; 531b5d61b8Smrg GLXDrawable drawable; 541b5d61b8Smrg GLXDrawable readdrawable; 551b5d61b8Smrg} GlxContextTagInfo; 561b5d61b8Smrg 571b5d61b8Smrgtypedef struct GlxClientPrivRec { 581b5d61b8Smrg GlxContextTagInfo *contextTags; 591b5d61b8Smrg unsigned int contextTagCount; 6025da500fSmrg 6125da500fSmrg /** 6225da500fSmrg * The vendor handles for each screen. 6325da500fSmrg */ 6425da500fSmrg GlxServerVendor **vendors; 651b5d61b8Smrg} GlxClientPriv; 661b5d61b8Smrg 671b5d61b8Smrgextern int GlxErrorBase; 681b5d61b8Smrgextern RESTYPE idResource; 691b5d61b8Smrg 701b5d61b8Smrgextern ExtensionEntry *GlxExtensionEntry; 711b5d61b8SmrgBool GlxDispatchInit(void); 721b5d61b8Smrgvoid GlxDispatchReset(void); 731b5d61b8Smrg 741b5d61b8Smrg/** 751b5d61b8Smrg * Handles a request from the client. 761b5d61b8Smrg * 771b5d61b8Smrg * This function will look up the correct handler function and forward the 781b5d61b8Smrg * request to it. 791b5d61b8Smrg */ 801b5d61b8Smrgint GlxDispatchRequest(ClientPtr client); 811b5d61b8Smrg 821b5d61b8Smrg/** 831b5d61b8Smrg * Looks up the GlxClientPriv struct for a client. If we don't have a 841b5d61b8Smrg * GlxClientPriv struct yet, then allocate one. 851b5d61b8Smrg */ 861b5d61b8SmrgGlxClientPriv *GlxGetClientData(ClientPtr client); 871b5d61b8Smrg 881b5d61b8Smrg/** 891b5d61b8Smrg * Frees any data that's specific to a client. This should be called when a 901b5d61b8Smrg * client disconnects. 911b5d61b8Smrg */ 921b5d61b8Smrgvoid GlxFreeClientData(ClientPtr client); 931b5d61b8Smrg 941b5d61b8SmrgBool GlxAddXIDMap(XID id, GlxServerVendor *vendor); 951b5d61b8SmrgGlxServerVendor * GlxGetXIDMap(XID id); 961b5d61b8Smrgvoid GlxRemoveXIDMap(XID id); 971b5d61b8Smrg 9825da500fSmrg/** 9925da500fSmrg * Records the client that sent the current request. This is needed in 10025da500fSmrg * GlxGetXIDMap to know which client's (screen -> vendor) mapping to use for a 10125da500fSmrg * regular X window. 10225da500fSmrg */ 10325da500fSmrgvoid GlxSetRequestClient(ClientPtr client); 10425da500fSmrg 1051b5d61b8SmrgGlxContextTagInfo *GlxAllocContextTag(ClientPtr client, GlxServerVendor *vendor); 1061b5d61b8SmrgGlxContextTagInfo *GlxLookupContextTag(ClientPtr client, GLXContextTag tag); 1071b5d61b8Smrgvoid GlxFreeContextTag(GlxContextTagInfo *tagInfo); 1081b5d61b8Smrg 1091b5d61b8SmrgBool GlxSetScreenVendor(ScreenPtr screen, GlxServerVendor *vendor); 11025da500fSmrgBool GlxSetClientScreenVendor(ClientPtr client, ScreenPtr screen, GlxServerVendor *vendor); 1111b5d61b8SmrgGlxScreenPriv *GlxGetScreen(ScreenPtr pScreen); 1121b5d61b8SmrgGlxServerVendor *GlxGetVendorForScreen(ClientPtr client, ScreenPtr screen); 1131b5d61b8Smrg 1141b5d61b8Smrgstatic inline CARD32 GlxCheckSwap(ClientPtr client, CARD32 value) 1151b5d61b8Smrg{ 1161b5d61b8Smrg if (client->swapped) 1171b5d61b8Smrg { 1181b5d61b8Smrg value = ((value & 0XFF000000) >> 24) | ((value & 0X00FF0000) >> 8) 1191b5d61b8Smrg | ((value & 0X0000FF00) << 8) | ((value & 0X000000FF) << 24); 1201b5d61b8Smrg } 1211b5d61b8Smrg return value; 1221b5d61b8Smrg} 1231b5d61b8Smrg 1241b5d61b8Smrg#if defined(__cplusplus) 1251b5d61b8Smrg} 1261b5d61b8Smrg#endif 1271b5d61b8Smrg 1281b5d61b8Smrg_X_EXPORT const GlxServerExports *glvndGetExports(void); 1291b5d61b8Smrg 1301b5d61b8Smrg#endif // VNDSERVER_H 131