1*61046927SAndroid Build Coastguard Worker /* 2*61046927SAndroid Build Coastguard Worker * Copyright © 2012 Intel Corporation 3*61046927SAndroid Build Coastguard Worker * 4*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a 5*61046927SAndroid Build Coastguard Worker * copy of this software and associated documentation files (the "Software"), 6*61046927SAndroid Build Coastguard Worker * to deal in the Software without restriction, including without limitation 7*61046927SAndroid Build Coastguard Worker * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*61046927SAndroid Build Coastguard Worker * and/or sell copies of the Software, and to permit persons to whom the 9*61046927SAndroid Build Coastguard Worker * Software is furnished to do so, subject to the following conditions: 10*61046927SAndroid Build Coastguard Worker * 11*61046927SAndroid Build Coastguard Worker * The above copyright notice and this permission notice (including the next 12*61046927SAndroid Build Coastguard Worker * paragraph) shall be included in all copies or substantial portions of the 13*61046927SAndroid Build Coastguard Worker * Software. 14*61046927SAndroid Build Coastguard Worker * 15*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16*61046927SAndroid Build Coastguard Worker * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17*61046927SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18*61046927SAndroid Build Coastguard Worker * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19*61046927SAndroid Build Coastguard Worker * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20*61046927SAndroid Build Coastguard Worker * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21*61046927SAndroid Build Coastguard Worker * IN THE SOFTWARE. 22*61046927SAndroid Build Coastguard Worker */ 23*61046927SAndroid Build Coastguard Worker 24*61046927SAndroid Build Coastguard Worker #ifndef _GLTHREAD_H 25*61046927SAndroid Build Coastguard Worker #define _GLTHREAD_H 26*61046927SAndroid Build Coastguard Worker 27*61046927SAndroid Build Coastguard Worker /* The size of one batch and the maximum size of one call. 28*61046927SAndroid Build Coastguard Worker * 29*61046927SAndroid Build Coastguard Worker * This should be as low as possible, so that: 30*61046927SAndroid Build Coastguard Worker * - multiple synchronizations within a frame don't slow us down much 31*61046927SAndroid Build Coastguard Worker * - a smaller number of calls per frame can still get decent parallelism 32*61046927SAndroid Build Coastguard Worker * - the memory footprint of the queue is low, and with that comes a lower 33*61046927SAndroid Build Coastguard Worker * chance of experiencing CPU cache thrashing 34*61046927SAndroid Build Coastguard Worker * but it should be high enough so that u_queue overhead remains negligible. 35*61046927SAndroid Build Coastguard Worker */ 36*61046927SAndroid Build Coastguard Worker #define MARSHAL_MAX_CMD_BUFFER_SIZE (8 * 1024) 37*61046927SAndroid Build Coastguard Worker 38*61046927SAndroid Build Coastguard Worker /* We need to leave 1 slot at the end to insert the END marker for unmarshal 39*61046927SAndroid Build Coastguard Worker * calls that look ahead to know where the batch ends. 40*61046927SAndroid Build Coastguard Worker */ 41*61046927SAndroid Build Coastguard Worker #define MARSHAL_MAX_CMD_SIZE (MARSHAL_MAX_CMD_BUFFER_SIZE - 8) 42*61046927SAndroid Build Coastguard Worker 43*61046927SAndroid Build Coastguard Worker /* The number of batch slots in memory. 44*61046927SAndroid Build Coastguard Worker * 45*61046927SAndroid Build Coastguard Worker * One batch is being executed, one batch is being filled, the rest are 46*61046927SAndroid Build Coastguard Worker * waiting batches. There must be at least 1 slot for a waiting batch, 47*61046927SAndroid Build Coastguard Worker * so the minimum number of batches is 3. 48*61046927SAndroid Build Coastguard Worker */ 49*61046927SAndroid Build Coastguard Worker #define MARSHAL_MAX_BATCHES 8 50*61046927SAndroid Build Coastguard Worker 51*61046927SAndroid Build Coastguard Worker /* Special value for glEnableClientState(GL_PRIMITIVE_RESTART_NV). */ 52*61046927SAndroid Build Coastguard Worker #define VERT_ATTRIB_PRIMITIVE_RESTART_NV -1 53*61046927SAndroid Build Coastguard Worker 54*61046927SAndroid Build Coastguard Worker #include <inttypes.h> 55*61046927SAndroid Build Coastguard Worker #include <stdbool.h> 56*61046927SAndroid Build Coastguard Worker #include "util/u_queue.h" 57*61046927SAndroid Build Coastguard Worker #include "compiler/shader_enums.h" 58*61046927SAndroid Build Coastguard Worker #include "main/config.h" 59*61046927SAndroid Build Coastguard Worker #include "main/hash.h" 60*61046927SAndroid Build Coastguard Worker #include "util/glheader.h" 61*61046927SAndroid Build Coastguard Worker 62*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus 63*61046927SAndroid Build Coastguard Worker extern "C" { 64*61046927SAndroid Build Coastguard Worker #endif 65*61046927SAndroid Build Coastguard Worker 66*61046927SAndroid Build Coastguard Worker struct gl_context; 67*61046927SAndroid Build Coastguard Worker struct gl_buffer_object; 68*61046927SAndroid Build Coastguard Worker struct _glapi_table; 69*61046927SAndroid Build Coastguard Worker 70*61046927SAndroid Build Coastguard Worker /** 71*61046927SAndroid Build Coastguard Worker * Client pixel packing/unpacking attributes 72*61046927SAndroid Build Coastguard Worker */ 73*61046927SAndroid Build Coastguard Worker struct gl_pixelstore_attrib 74*61046927SAndroid Build Coastguard Worker { 75*61046927SAndroid Build Coastguard Worker GLint Alignment; 76*61046927SAndroid Build Coastguard Worker GLint RowLength; 77*61046927SAndroid Build Coastguard Worker GLint SkipPixels; 78*61046927SAndroid Build Coastguard Worker GLint SkipRows; 79*61046927SAndroid Build Coastguard Worker GLint ImageHeight; 80*61046927SAndroid Build Coastguard Worker GLint SkipImages; 81*61046927SAndroid Build Coastguard Worker GLboolean SwapBytes; 82*61046927SAndroid Build Coastguard Worker GLboolean LsbFirst; 83*61046927SAndroid Build Coastguard Worker GLboolean Invert; /**< GL_MESA_pack_invert */ 84*61046927SAndroid Build Coastguard Worker GLint CompressedBlockWidth; /**< GL_ARB_compressed_texture_pixel_storage */ 85*61046927SAndroid Build Coastguard Worker GLint CompressedBlockHeight; 86*61046927SAndroid Build Coastguard Worker GLint CompressedBlockDepth; 87*61046927SAndroid Build Coastguard Worker GLint CompressedBlockSize; 88*61046927SAndroid Build Coastguard Worker struct gl_buffer_object *BufferObj; /**< GL_ARB_pixel_buffer_object */ 89*61046927SAndroid Build Coastguard Worker }; 90*61046927SAndroid Build Coastguard Worker 91*61046927SAndroid Build Coastguard Worker /* Used by both glthread and gl_context. */ 92*61046927SAndroid Build Coastguard Worker union gl_vertex_format_user { 93*61046927SAndroid Build Coastguard Worker struct { 94*61046927SAndroid Build Coastguard Worker GLenum16 Type; /**< datatype: GL_FLOAT, GL_INT, etc */ 95*61046927SAndroid Build Coastguard Worker bool Bgra; /**< true if GL_BGRA, else GL_RGBA */ 96*61046927SAndroid Build Coastguard Worker uint8_t Size:5; /**< components per element (1,2,3,4) */ 97*61046927SAndroid Build Coastguard Worker bool Normalized:1; /**< GL_ARB_vertex_program */ 98*61046927SAndroid Build Coastguard Worker bool Integer:1; /**< Integer-valued? */ 99*61046927SAndroid Build Coastguard Worker bool Doubles:1; /**< double values are not converted to floats */ 100*61046927SAndroid Build Coastguard Worker }; 101*61046927SAndroid Build Coastguard Worker uint32_t All; 102*61046927SAndroid Build Coastguard Worker }; 103*61046927SAndroid Build Coastguard Worker 104*61046927SAndroid Build Coastguard Worker #define MESA_PACK_VFORMAT(type, size, normalized, integer, doubles) \ 105*61046927SAndroid Build Coastguard Worker (union gl_vertex_format_user){{ \ 106*61046927SAndroid Build Coastguard Worker .Type = MIN2(type, 0xffff), /* 0xffff means invalid value */ \ 107*61046927SAndroid Build Coastguard Worker .Bgra = size == GL_BGRA, \ 108*61046927SAndroid Build Coastguard Worker .Size = size == GL_BGRA ? 4 : MIN2(size, 5), /* 5 means invalid value */ \ 109*61046927SAndroid Build Coastguard Worker .Normalized = normalized, \ 110*61046927SAndroid Build Coastguard Worker .Integer = integer, \ 111*61046927SAndroid Build Coastguard Worker .Doubles = doubles \ 112*61046927SAndroid Build Coastguard Worker }} 113*61046927SAndroid Build Coastguard Worker 114*61046927SAndroid Build Coastguard Worker struct glthread_attrib { 115*61046927SAndroid Build Coastguard Worker /* Per attrib: */ 116*61046927SAndroid Build Coastguard Worker uint8_t ElementSize; /**< max 32 */ 117*61046927SAndroid Build Coastguard Worker uint8_t BufferIndex; /**< Referring to Attrib[BufferIndex]. */ 118*61046927SAndroid Build Coastguard Worker uint16_t RelativeOffset; /**< max 0xffff in Mesa */ 119*61046927SAndroid Build Coastguard Worker union gl_vertex_format_user Format; 120*61046927SAndroid Build Coastguard Worker 121*61046927SAndroid Build Coastguard Worker /* Per buffer binding: */ 122*61046927SAndroid Build Coastguard Worker GLuint Divisor; 123*61046927SAndroid Build Coastguard Worker int16_t Stride; /**< max 2048 */ 124*61046927SAndroid Build Coastguard Worker int8_t EnabledAttribCount; /**< Number of enabled attribs using this buffer. */ 125*61046927SAndroid Build Coastguard Worker const void *Pointer; 126*61046927SAndroid Build Coastguard Worker }; 127*61046927SAndroid Build Coastguard Worker 128*61046927SAndroid Build Coastguard Worker struct glthread_vao { 129*61046927SAndroid Build Coastguard Worker GLuint Name; 130*61046927SAndroid Build Coastguard Worker GLuint CurrentElementBufferName; 131*61046927SAndroid Build Coastguard Worker GLbitfield UserEnabled; /**< Vertex attribs enabled by the user. */ 132*61046927SAndroid Build Coastguard Worker GLbitfield Enabled; /**< UserEnabled with POS vs GENERIC0 aliasing resolved. */ 133*61046927SAndroid Build Coastguard Worker GLbitfield BufferEnabled; /**< "Enabled" converted to buffer bindings. */ 134*61046927SAndroid Build Coastguard Worker GLbitfield BufferInterleaved; /**< Bitmask of buffers used by multiple attribs. */ 135*61046927SAndroid Build Coastguard Worker GLbitfield UserPointerMask; /**< Bitmask of buffer bindings. */ 136*61046927SAndroid Build Coastguard Worker GLbitfield NonNullPointerMask; /**< Bitmask of buffer bindings with non-NULL user pointers. */ 137*61046927SAndroid Build Coastguard Worker GLbitfield NonZeroDivisorMask; /**< Bitmask of buffer bindings. */ 138*61046927SAndroid Build Coastguard Worker 139*61046927SAndroid Build Coastguard Worker struct glthread_attrib Attrib[VERT_ATTRIB_MAX]; 140*61046927SAndroid Build Coastguard Worker }; 141*61046927SAndroid Build Coastguard Worker 142*61046927SAndroid Build Coastguard Worker /** A single batch of commands queued up for execution. */ 143*61046927SAndroid Build Coastguard Worker struct glthread_batch 144*61046927SAndroid Build Coastguard Worker { 145*61046927SAndroid Build Coastguard Worker /** Batch fence for waiting for the execution to finish. */ 146*61046927SAndroid Build Coastguard Worker struct util_queue_fence fence; 147*61046927SAndroid Build Coastguard Worker 148*61046927SAndroid Build Coastguard Worker /** The worker thread will access the context with this. */ 149*61046927SAndroid Build Coastguard Worker struct gl_context *ctx; 150*61046927SAndroid Build Coastguard Worker 151*61046927SAndroid Build Coastguard Worker /** 152*61046927SAndroid Build Coastguard Worker * Number of uint64_t elements filled already. 153*61046927SAndroid Build Coastguard Worker * This is 0 when it's being filled because glthread::used holds the real 154*61046927SAndroid Build Coastguard Worker * value temporarily, and glthread::used is copied to this variable when 155*61046927SAndroid Build Coastguard Worker * the batch is submitted. 156*61046927SAndroid Build Coastguard Worker */ 157*61046927SAndroid Build Coastguard Worker unsigned used; 158*61046927SAndroid Build Coastguard Worker 159*61046927SAndroid Build Coastguard Worker /** Data contained in the command buffer. */ 160*61046927SAndroid Build Coastguard Worker uint64_t buffer[MARSHAL_MAX_CMD_BUFFER_SIZE / 8]; 161*61046927SAndroid Build Coastguard Worker }; 162*61046927SAndroid Build Coastguard Worker 163*61046927SAndroid Build Coastguard Worker struct glthread_client_attrib { 164*61046927SAndroid Build Coastguard Worker struct glthread_vao VAO; 165*61046927SAndroid Build Coastguard Worker GLuint CurrentArrayBufferName; 166*61046927SAndroid Build Coastguard Worker int ClientActiveTexture; 167*61046927SAndroid Build Coastguard Worker GLuint RestartIndex; 168*61046927SAndroid Build Coastguard Worker bool PrimitiveRestart; 169*61046927SAndroid Build Coastguard Worker bool PrimitiveRestartFixedIndex; 170*61046927SAndroid Build Coastguard Worker 171*61046927SAndroid Build Coastguard Worker /** Whether this element of the client attrib stack contains saved state. */ 172*61046927SAndroid Build Coastguard Worker bool Valid; 173*61046927SAndroid Build Coastguard Worker }; 174*61046927SAndroid Build Coastguard Worker 175*61046927SAndroid Build Coastguard Worker /* For glPushAttrib / glPopAttrib. */ 176*61046927SAndroid Build Coastguard Worker struct glthread_attrib_node { 177*61046927SAndroid Build Coastguard Worker GLbitfield Mask; 178*61046927SAndroid Build Coastguard Worker int ActiveTexture; 179*61046927SAndroid Build Coastguard Worker GLenum16 MatrixMode; 180*61046927SAndroid Build Coastguard Worker bool Blend; 181*61046927SAndroid Build Coastguard Worker bool CullFace; 182*61046927SAndroid Build Coastguard Worker bool DepthTest; 183*61046927SAndroid Build Coastguard Worker bool Lighting; 184*61046927SAndroid Build Coastguard Worker bool PolygonStipple; 185*61046927SAndroid Build Coastguard Worker }; 186*61046927SAndroid Build Coastguard Worker 187*61046927SAndroid Build Coastguard Worker typedef enum { 188*61046927SAndroid Build Coastguard Worker M_MODELVIEW, 189*61046927SAndroid Build Coastguard Worker M_PROJECTION, 190*61046927SAndroid Build Coastguard Worker M_PROGRAM0, 191*61046927SAndroid Build Coastguard Worker M_PROGRAM_LAST = M_PROGRAM0 + MAX_PROGRAM_MATRICES - 1, 192*61046927SAndroid Build Coastguard Worker M_TEXTURE0, 193*61046927SAndroid Build Coastguard Worker M_TEXTURE_LAST = M_TEXTURE0 + MAX_TEXTURE_UNITS - 1, 194*61046927SAndroid Build Coastguard Worker M_DUMMY, /* used instead of reporting errors */ 195*61046927SAndroid Build Coastguard Worker M_NUM_MATRIX_STACKS, 196*61046927SAndroid Build Coastguard Worker } gl_matrix_index; 197*61046927SAndroid Build Coastguard Worker 198*61046927SAndroid Build Coastguard Worker struct glthread_state 199*61046927SAndroid Build Coastguard Worker { 200*61046927SAndroid Build Coastguard Worker /** Multithreaded queue. */ 201*61046927SAndroid Build Coastguard Worker struct util_queue queue; 202*61046927SAndroid Build Coastguard Worker 203*61046927SAndroid Build Coastguard Worker /** This is sent to the driver for framebuffer overlay / HUD. */ 204*61046927SAndroid Build Coastguard Worker struct util_queue_monitoring stats; 205*61046927SAndroid Build Coastguard Worker 206*61046927SAndroid Build Coastguard Worker /** Whether GLThread is enabled. */ 207*61046927SAndroid Build Coastguard Worker bool enabled; 208*61046927SAndroid Build Coastguard Worker bool inside_begin_end; 209*61046927SAndroid Build Coastguard Worker bool thread_sched_enabled; 210*61046927SAndroid Build Coastguard Worker 211*61046927SAndroid Build Coastguard Worker /** Display lists. */ 212*61046927SAndroid Build Coastguard Worker GLenum16 ListMode; /**< Zero if not inside display list, else list mode. */ 213*61046927SAndroid Build Coastguard Worker unsigned ListBase; 214*61046927SAndroid Build Coastguard Worker unsigned ListCallDepth; 215*61046927SAndroid Build Coastguard Worker 216*61046927SAndroid Build Coastguard Worker /** For L3 cache pinning. */ 217*61046927SAndroid Build Coastguard Worker unsigned pin_thread_counter; 218*61046927SAndroid Build Coastguard Worker unsigned thread_sched_state; 219*61046927SAndroid Build Coastguard Worker 220*61046927SAndroid Build Coastguard Worker /** The ring of batches in memory. */ 221*61046927SAndroid Build Coastguard Worker struct glthread_batch batches[MARSHAL_MAX_BATCHES]; 222*61046927SAndroid Build Coastguard Worker 223*61046927SAndroid Build Coastguard Worker /** Pointer to the batch currently being filled. */ 224*61046927SAndroid Build Coastguard Worker struct glthread_batch *next_batch; 225*61046927SAndroid Build Coastguard Worker 226*61046927SAndroid Build Coastguard Worker /** Index of the last submitted batch. */ 227*61046927SAndroid Build Coastguard Worker unsigned last; 228*61046927SAndroid Build Coastguard Worker 229*61046927SAndroid Build Coastguard Worker /** Index of the batch being filled and about to be submitted. */ 230*61046927SAndroid Build Coastguard Worker unsigned next; 231*61046927SAndroid Build Coastguard Worker 232*61046927SAndroid Build Coastguard Worker /** Number of uint64_t elements filled already. */ 233*61046927SAndroid Build Coastguard Worker unsigned used; 234*61046927SAndroid Build Coastguard Worker 235*61046927SAndroid Build Coastguard Worker /** Upload buffer. */ 236*61046927SAndroid Build Coastguard Worker struct gl_buffer_object *upload_buffer; 237*61046927SAndroid Build Coastguard Worker uint8_t *upload_ptr; 238*61046927SAndroid Build Coastguard Worker unsigned upload_offset; 239*61046927SAndroid Build Coastguard Worker int upload_buffer_private_refcount; 240*61046927SAndroid Build Coastguard Worker 241*61046927SAndroid Build Coastguard Worker /** Primitive restart state. */ 242*61046927SAndroid Build Coastguard Worker bool PrimitiveRestart; 243*61046927SAndroid Build Coastguard Worker bool PrimitiveRestartFixedIndex; 244*61046927SAndroid Build Coastguard Worker bool _PrimitiveRestart; 245*61046927SAndroid Build Coastguard Worker GLuint RestartIndex; 246*61046927SAndroid Build Coastguard Worker GLuint _RestartIndex[4]; /**< Restart index for index_size = 1,2,4. */ 247*61046927SAndroid Build Coastguard Worker 248*61046927SAndroid Build Coastguard Worker /** Vertex Array objects tracked by glthread independently of Mesa. */ 249*61046927SAndroid Build Coastguard Worker struct _mesa_HashTable VAOs; 250*61046927SAndroid Build Coastguard Worker struct glthread_vao *CurrentVAO; 251*61046927SAndroid Build Coastguard Worker struct glthread_vao *LastLookedUpVAO; 252*61046927SAndroid Build Coastguard Worker struct glthread_vao DefaultVAO; 253*61046927SAndroid Build Coastguard Worker struct glthread_client_attrib ClientAttribStack[MAX_CLIENT_ATTRIB_STACK_DEPTH]; 254*61046927SAndroid Build Coastguard Worker int ClientAttribStackTop; 255*61046927SAndroid Build Coastguard Worker int ClientActiveTexture; 256*61046927SAndroid Build Coastguard Worker 257*61046927SAndroid Build Coastguard Worker /** Currently-bound buffer object IDs. */ 258*61046927SAndroid Build Coastguard Worker GLuint CurrentArrayBufferName; 259*61046927SAndroid Build Coastguard Worker GLuint CurrentDrawIndirectBufferName; 260*61046927SAndroid Build Coastguard Worker GLuint CurrentPixelPackBufferName; 261*61046927SAndroid Build Coastguard Worker GLuint CurrentPixelUnpackBufferName; 262*61046927SAndroid Build Coastguard Worker GLuint CurrentQueryBufferName; 263*61046927SAndroid Build Coastguard Worker 264*61046927SAndroid Build Coastguard Worker /** 265*61046927SAndroid Build Coastguard Worker * The batch index of the last occurence of glLinkProgram or 266*61046927SAndroid Build Coastguard Worker * glDeleteProgram or -1 if there is no such enqueued call. 267*61046927SAndroid Build Coastguard Worker */ 268*61046927SAndroid Build Coastguard Worker int LastProgramChangeBatch; 269*61046927SAndroid Build Coastguard Worker 270*61046927SAndroid Build Coastguard Worker /** 271*61046927SAndroid Build Coastguard Worker * The batch index of the last occurence of glEndList or 272*61046927SAndroid Build Coastguard Worker * glDeleteLists or -1 if there is no such enqueued call. 273*61046927SAndroid Build Coastguard Worker */ 274*61046927SAndroid Build Coastguard Worker int LastDListChangeBatchIndex; 275*61046927SAndroid Build Coastguard Worker 276*61046927SAndroid Build Coastguard Worker /** Basic matrix state tracking. */ 277*61046927SAndroid Build Coastguard Worker int ActiveTexture; 278*61046927SAndroid Build Coastguard Worker GLenum16 MatrixMode; 279*61046927SAndroid Build Coastguard Worker gl_matrix_index MatrixIndex; 280*61046927SAndroid Build Coastguard Worker struct glthread_attrib_node AttribStack[MAX_ATTRIB_STACK_DEPTH]; 281*61046927SAndroid Build Coastguard Worker int AttribStackDepth; 282*61046927SAndroid Build Coastguard Worker int MatrixStackDepth[M_NUM_MATRIX_STACKS]; 283*61046927SAndroid Build Coastguard Worker 284*61046927SAndroid Build Coastguard Worker /** Enable states. */ 285*61046927SAndroid Build Coastguard Worker bool Blend; 286*61046927SAndroid Build Coastguard Worker bool DepthTest; 287*61046927SAndroid Build Coastguard Worker bool CullFace; 288*61046927SAndroid Build Coastguard Worker bool DebugOutputSynchronous; 289*61046927SAndroid Build Coastguard Worker bool Lighting; 290*61046927SAndroid Build Coastguard Worker bool PolygonStipple; 291*61046927SAndroid Build Coastguard Worker 292*61046927SAndroid Build Coastguard Worker GLuint CurrentDrawFramebuffer; 293*61046927SAndroid Build Coastguard Worker GLuint CurrentReadFramebuffer; 294*61046927SAndroid Build Coastguard Worker GLuint CurrentProgram; 295*61046927SAndroid Build Coastguard Worker 296*61046927SAndroid Build Coastguard Worker /** The last added call of the given function. */ 297*61046927SAndroid Build Coastguard Worker struct marshal_cmd_CallList *LastCallList; 298*61046927SAndroid Build Coastguard Worker struct marshal_cmd_BindBuffer *LastBindBuffer1; 299*61046927SAndroid Build Coastguard Worker struct marshal_cmd_BindBuffer *LastBindBuffer2; 300*61046927SAndroid Build Coastguard Worker 301*61046927SAndroid Build Coastguard Worker /** Global mutex update info. */ 302*61046927SAndroid Build Coastguard Worker unsigned GlobalLockUpdateBatchCounter; 303*61046927SAndroid Build Coastguard Worker bool LockGlobalMutexes; 304*61046927SAndroid Build Coastguard Worker 305*61046927SAndroid Build Coastguard Worker struct gl_pixelstore_attrib Unpack; 306*61046927SAndroid Build Coastguard Worker }; 307*61046927SAndroid Build Coastguard Worker 308*61046927SAndroid Build Coastguard Worker void _mesa_glthread_init(struct gl_context *ctx); 309*61046927SAndroid Build Coastguard Worker void _mesa_glthread_destroy(struct gl_context *ctx); 310*61046927SAndroid Build Coastguard Worker 311*61046927SAndroid Build Coastguard Worker void _mesa_glthread_init_dispatch0(struct gl_context *ctx, 312*61046927SAndroid Build Coastguard Worker struct _glapi_table *table); 313*61046927SAndroid Build Coastguard Worker void _mesa_glthread_init_dispatch1(struct gl_context *ctx, 314*61046927SAndroid Build Coastguard Worker struct _glapi_table *table); 315*61046927SAndroid Build Coastguard Worker void _mesa_glthread_init_dispatch2(struct gl_context *ctx, 316*61046927SAndroid Build Coastguard Worker struct _glapi_table *table); 317*61046927SAndroid Build Coastguard Worker void _mesa_glthread_init_dispatch3(struct gl_context *ctx, 318*61046927SAndroid Build Coastguard Worker struct _glapi_table *table); 319*61046927SAndroid Build Coastguard Worker void _mesa_glthread_init_dispatch4(struct gl_context *ctx, 320*61046927SAndroid Build Coastguard Worker struct _glapi_table *table); 321*61046927SAndroid Build Coastguard Worker void _mesa_glthread_init_dispatch5(struct gl_context *ctx, 322*61046927SAndroid Build Coastguard Worker struct _glapi_table *table); 323*61046927SAndroid Build Coastguard Worker void _mesa_glthread_init_dispatch6(struct gl_context *ctx, 324*61046927SAndroid Build Coastguard Worker struct _glapi_table *table); 325*61046927SAndroid Build Coastguard Worker void _mesa_glthread_init_dispatch7(struct gl_context *ctx, 326*61046927SAndroid Build Coastguard Worker struct _glapi_table *table); 327*61046927SAndroid Build Coastguard Worker 328*61046927SAndroid Build Coastguard Worker void _mesa_glthread_enable(struct gl_context *ctx); 329*61046927SAndroid Build Coastguard Worker void _mesa_glthread_disable(struct gl_context *ctx); 330*61046927SAndroid Build Coastguard Worker void _mesa_glthread_flush_batch(struct gl_context *ctx); 331*61046927SAndroid Build Coastguard Worker void _mesa_glthread_finish(struct gl_context *ctx); 332*61046927SAndroid Build Coastguard Worker void _mesa_glthread_finish_before(struct gl_context *ctx, const char *func); 333*61046927SAndroid Build Coastguard Worker bool _mesa_glthread_invalidate_zsbuf(struct gl_context *ctx); 334*61046927SAndroid Build Coastguard Worker void _mesa_glthread_release_upload_buffer(struct gl_context *ctx); 335*61046927SAndroid Build Coastguard Worker void _mesa_glthread_upload(struct gl_context *ctx, const void *data, 336*61046927SAndroid Build Coastguard Worker GLsizeiptr size, unsigned *out_offset, 337*61046927SAndroid Build Coastguard Worker struct gl_buffer_object **out_buffer, 338*61046927SAndroid Build Coastguard Worker uint8_t **out_ptr, 339*61046927SAndroid Build Coastguard Worker unsigned start_offset); 340*61046927SAndroid Build Coastguard Worker void _mesa_glthread_reset_vao(struct glthread_vao *vao); 341*61046927SAndroid Build Coastguard Worker void _mesa_error_glthread_safe(struct gl_context *ctx, GLenum error, 342*61046927SAndroid Build Coastguard Worker bool glthread, const char *format, ...); 343*61046927SAndroid Build Coastguard Worker void _mesa_glthread_execute_list(struct gl_context *ctx, GLuint list); 344*61046927SAndroid Build Coastguard Worker 345*61046927SAndroid Build Coastguard Worker void _mesa_glthread_DeleteBuffers(struct gl_context *ctx, GLsizei n, 346*61046927SAndroid Build Coastguard Worker const GLuint *buffers); 347*61046927SAndroid Build Coastguard Worker 348*61046927SAndroid Build Coastguard Worker void _mesa_glthread_BindVertexArray(struct gl_context *ctx, GLuint id); 349*61046927SAndroid Build Coastguard Worker void _mesa_glthread_DeleteVertexArrays(struct gl_context *ctx, 350*61046927SAndroid Build Coastguard Worker GLsizei n, const GLuint *ids); 351*61046927SAndroid Build Coastguard Worker void _mesa_glthread_GenVertexArrays(struct gl_context *ctx, 352*61046927SAndroid Build Coastguard Worker GLsizei n, GLuint *arrays); 353*61046927SAndroid Build Coastguard Worker void _mesa_glthread_set_prim_restart(struct gl_context *ctx, GLenum cap, 354*61046927SAndroid Build Coastguard Worker bool value); 355*61046927SAndroid Build Coastguard Worker void _mesa_glthread_PrimitiveRestartIndex(struct gl_context *ctx, GLuint index); 356*61046927SAndroid Build Coastguard Worker void _mesa_glthread_ClientState(struct gl_context *ctx, GLuint *vaobj, 357*61046927SAndroid Build Coastguard Worker gl_vert_attrib attrib, bool enable); 358*61046927SAndroid Build Coastguard Worker void _mesa_glthread_AttribDivisor(struct gl_context *ctx, const GLuint *vaobj, 359*61046927SAndroid Build Coastguard Worker gl_vert_attrib attrib, GLuint divisor); 360*61046927SAndroid Build Coastguard Worker void _mesa_glthread_AttribPointer(struct gl_context *ctx, gl_vert_attrib attrib, 361*61046927SAndroid Build Coastguard Worker union gl_vertex_format_user format, 362*61046927SAndroid Build Coastguard Worker GLsizei stride, const void *pointer); 363*61046927SAndroid Build Coastguard Worker void _mesa_glthread_DSAAttribPointer(struct gl_context *ctx, GLuint vao, 364*61046927SAndroid Build Coastguard Worker GLuint buffer, gl_vert_attrib attrib, 365*61046927SAndroid Build Coastguard Worker union gl_vertex_format_user format, 366*61046927SAndroid Build Coastguard Worker GLsizei stride, GLintptr offset); 367*61046927SAndroid Build Coastguard Worker void _mesa_glthread_AttribFormat(struct gl_context *ctx, GLuint attribindex, 368*61046927SAndroid Build Coastguard Worker union gl_vertex_format_user format, 369*61046927SAndroid Build Coastguard Worker GLuint relativeoffset); 370*61046927SAndroid Build Coastguard Worker void _mesa_glthread_DSAAttribFormat(struct gl_context *ctx, GLuint vaobj, 371*61046927SAndroid Build Coastguard Worker GLuint attribindex, 372*61046927SAndroid Build Coastguard Worker union gl_vertex_format_user format, 373*61046927SAndroid Build Coastguard Worker GLuint relativeoffset); 374*61046927SAndroid Build Coastguard Worker void _mesa_glthread_VertexBuffer(struct gl_context *ctx, GLuint bindingindex, 375*61046927SAndroid Build Coastguard Worker GLuint buffer, GLintptr offset, GLsizei stride); 376*61046927SAndroid Build Coastguard Worker void _mesa_glthread_DSAVertexBuffer(struct gl_context *ctx, GLuint vaobj, 377*61046927SAndroid Build Coastguard Worker GLuint bindingindex, GLuint buffer, 378*61046927SAndroid Build Coastguard Worker GLintptr offset, GLsizei stride); 379*61046927SAndroid Build Coastguard Worker void _mesa_glthread_DSAVertexBuffers(struct gl_context *ctx, GLuint vaobj, 380*61046927SAndroid Build Coastguard Worker GLuint first, GLsizei count, 381*61046927SAndroid Build Coastguard Worker const GLuint *buffers, 382*61046927SAndroid Build Coastguard Worker const GLintptr *offsets, 383*61046927SAndroid Build Coastguard Worker const GLsizei *strides); 384*61046927SAndroid Build Coastguard Worker void _mesa_glthread_BindingDivisor(struct gl_context *ctx, GLuint bindingindex, 385*61046927SAndroid Build Coastguard Worker GLuint divisor); 386*61046927SAndroid Build Coastguard Worker void _mesa_glthread_DSABindingDivisor(struct gl_context *ctx, GLuint vaobj, 387*61046927SAndroid Build Coastguard Worker GLuint bindingindex, GLuint divisor); 388*61046927SAndroid Build Coastguard Worker void _mesa_glthread_AttribBinding(struct gl_context *ctx, GLuint attribindex, 389*61046927SAndroid Build Coastguard Worker GLuint bindingindex); 390*61046927SAndroid Build Coastguard Worker void _mesa_glthread_DSAAttribBinding(struct gl_context *ctx, GLuint vaobj, 391*61046927SAndroid Build Coastguard Worker GLuint attribindex, GLuint bindingindex); 392*61046927SAndroid Build Coastguard Worker void _mesa_glthread_DSAElementBuffer(struct gl_context *ctx, GLuint vaobj, 393*61046927SAndroid Build Coastguard Worker GLuint buffer); 394*61046927SAndroid Build Coastguard Worker void _mesa_glthread_PushClientAttrib(struct gl_context *ctx, GLbitfield mask, 395*61046927SAndroid Build Coastguard Worker bool set_default); 396*61046927SAndroid Build Coastguard Worker void _mesa_glthread_PopClientAttrib(struct gl_context *ctx); 397*61046927SAndroid Build Coastguard Worker void _mesa_glthread_ClientAttribDefault(struct gl_context *ctx, GLbitfield mask); 398*61046927SAndroid Build Coastguard Worker void _mesa_glthread_InterleavedArrays(struct gl_context *ctx, GLenum format, 399*61046927SAndroid Build Coastguard Worker GLsizei stride, const GLvoid *pointer); 400*61046927SAndroid Build Coastguard Worker void _mesa_glthread_ProgramChanged(struct gl_context *ctx); 401*61046927SAndroid Build Coastguard Worker void _mesa_glthread_UnrollDrawElements(struct gl_context *ctx, 402*61046927SAndroid Build Coastguard Worker GLenum mode, GLsizei count, GLenum type, 403*61046927SAndroid Build Coastguard Worker const GLvoid *indices, GLint basevertex); 404*61046927SAndroid Build Coastguard Worker void _mesa_glthread_unbind_uploaded_vbos(struct gl_context *ctx); 405*61046927SAndroid Build Coastguard Worker void _mesa_glthread_PixelStorei(struct gl_context *ctx, GLenum pname, 406*61046927SAndroid Build Coastguard Worker GLint param); 407*61046927SAndroid Build Coastguard Worker 408*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus 409*61046927SAndroid Build Coastguard Worker } 410*61046927SAndroid Build Coastguard Worker #endif 411*61046927SAndroid Build Coastguard Worker 412*61046927SAndroid Build Coastguard Worker #endif /* _GLTHREAD_H*/ 413