a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/*
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * (C) Copyright IBM Corporation 2005, 2006
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * All Rights Reserved.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Permission is hereby granted, free of charge, to any person obtaining a
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * copy of this software and associated documentation files (the "Software"),
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * to deal in the Software without restriction, including without limitation
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * the rights to use, copy, modify, merge, publish, distribute, sub license,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * and/or sell copies of the Software, and to permit persons to whom the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Software is furnished to do so, subject to the following conditions:
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The above copyright notice and this permission notice (including the next
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * paragraph) shall be included in all copies or substantial portions of the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Software.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * IBM,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * SOFTWARE.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * \file indirect_table.h
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * \author Ian Romanick <idr@us.ibm.com>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#ifndef INDIRECT_TABLE_H
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define INDIRECT_TABLE_H
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#include <inttypes.h>
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncstruct __glXDispatchInfo {
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Number of significant bits in the protocol opcode. Opcodes with values
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * larger than ((1 << bits) - 1) are invalid.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync unsigned bits;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync const int_fast16_t *dispatch_tree;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Array of protocol decode and dispatch functions index by the opcode
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * search tree (i.e., \c dispatch_tree). The first element in each pair
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * is the non-byte-swapped version, and the second element is the
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * byte-swapped version.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync const void *(*dispatch_functions)[2];
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Pointer to size validation data. This table is indexed with the same
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * value as ::dispatch_functions.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * The first element in the pair is the size, in bytes, of the fixed-size
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * portion of the protocol.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * For opcodes that have a variable-size portion, the second value is an
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * index in \c size_func_table to calculate that size. If there is no
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * variable-size portion, this index will be ~0.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * \note
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * If size checking is not to be performed on this type of protocol
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * data, this pointer will be \c NULL.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync const int_fast16_t(*size_table)[2];
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync /**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Array of functions used to calculate the variable-size portion of
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * protocol messages. Indexed by the second element of the entries
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * in \c ::size_table.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync *
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * \note
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * If size checking is not to be performed on this type of protocol
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * data, this pointer will be \c NULL.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync const gl_proto_size_func *size_func_table;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync};
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Sentinel value for an empty leaf in the \c dispatch_tree.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define EMPTY_LEAF INT_FAST16_MIN
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Declare the index \c x as a leaf index.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define LEAF(x) -x
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync/**
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync * Determine if an index is a leaf index.
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync */
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#define IS_LEAF_INDEX(x) ((x) <= 0)
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern const struct __glXDispatchInfo Single_dispatch_info;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern const struct __glXDispatchInfo Render_dispatch_info;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsyncextern const struct __glXDispatchInfo VendorPriv_dispatch_info;
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync
a3f3701cea1ba388e7c877955252bb7375eedebdvboxsync#endif /* INDIRECT_TABLE_H */