aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libX11/man/xkb/XkbComputeShapeTop.man2
-rw-r--r--libX11/specs/libX11/CH08.xml3
-rw-r--r--mesalib/src/mesa/main/atifragshader.c4
-rw-r--r--mesalib/src/mesa/main/buffers.c1068
-rw-r--r--mesalib/src/mesa/main/dlist.c427
-rw-r--r--mesalib/src/mesa/main/fbobject.c2
-rw-r--r--mesalib/src/mesa/main/queryobj.c12
-rw-r--r--mesalib/src/mesa/main/queryobj.h174
-rw-r--r--mesalib/src/mesa/main/shaderapi.c8
-rw-r--r--mesalib/src/mesa/main/texformat.c1528
-rw-r--r--mesalib/src/mesa/main/teximage.c2
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp3
-rw-r--r--mesalib/src/mesa/program/prog_parameter_layout.c1
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_accum.c694
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c3
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c26
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_readpixels.c9
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_gen_mipmap.c902
-rw-r--r--mkfontscale/list.h8
-rw-r--r--pixman/pixman/Makefile.win321
-rw-r--r--xorg-server/dix/devices.c9
-rw-r--r--xorg-server/dix/events.c7
-rw-r--r--xorg-server/dix/inpututils.c2
-rw-r--r--xorg-server/fb/fbbltone.c4
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyr.c25
-rw-r--r--xorg-server/hw/kdrive/ephyr/ephyrinit.c7
-rw-r--r--xorg-server/hw/xfree86/common/xf86Module.h2
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c21
-rw-r--r--xorg-server/hw/xfree86/man/xorg.conf.man10
-rw-r--r--xorg-server/hw/xfree86/parser/InputClass.c827
-rw-r--r--xorg-server/hw/xfree86/parser/xf86Parser.h1037
-rw-r--r--xorg-server/hw/xfree86/parser/xf86tokens.h587
-rw-r--r--xorg-server/hw/xwin/winkeybd.c2
-rw-r--r--xorg-server/hw/xwin/winmouse.c5
-rw-r--r--xorg-server/include/input.h6
-rw-r--r--xorg-server/include/inputstr.h2
-rw-r--r--xorg-server/include/xserver-properties.h390
-rw-r--r--xorg-server/mi/mieq.c1
-rw-r--r--xorg-server/randr/rrscreen.c12
-rw-r--r--xorg-server/xkeyboard-config/rules/base.extras.xml.in12
-rw-r--r--xorg-server/xkeyboard-config/rules/base.xml.in10
43 files changed, 4166 insertions, 3695 deletions
diff --git a/libX11/man/xkb/XkbComputeShapeTop.man b/libX11/man/xkb/XkbComputeShapeTop.man
index 6dcfcd29c..1a7f72a00 100644
--- a/libX11/man/xkb/XkbComputeShapeTop.man
+++ b/libX11/man/xkb/XkbComputeShapeTop.man
@@ -47,7 +47,7 @@ a number of points. The bounding box of a shape is a rectangle that contains all
the outlines of that shape.
.I XkbComputeShapeTop
-returns a BoundsRec that contains two x and y coordinates. These coordinates
+returns a BoundsRec that contains two x and y coordinates. These coordinates
describe the corners of a rectangle that contains the outline that describes the
top surface of the shape. The top surface is defined to be the approximating
outline if the
diff --git a/libX11/specs/libX11/CH08.xml b/libX11/specs/libX11/CH08.xml
index 1f1202505..8e84213cd 100644
--- a/libX11/specs/libX11/CH08.xml
+++ b/libX11/specs/libX11/CH08.xml
@@ -4744,7 +4744,8 @@ To draw 8-bit characters in a given drawable, use
<paramdef>Display<parameter> *display</parameter></paramdef>
<paramdef>Drawable<parameter> d</parameter></paramdef>
<paramdef>GC<parameter> gc</parameter></paramdef>
- <paramdef>intx,<parameter> y</parameter></paramdef>
+ <paramdef>int<parameter> x</parameter></paramdef>
+ <paramdef>int<parameter> y</parameter></paramdef>
<paramdef>char<parameter> *string</parameter></paramdef>
<paramdef>int<parameter> length</parameter></paramdef>
</funcprototype>
diff --git a/mesalib/src/mesa/main/atifragshader.c b/mesalib/src/mesa/main/atifragshader.c
index 1707f0b95..ff7b042d2 100644
--- a/mesalib/src/mesa/main/atifragshader.c
+++ b/mesalib/src/mesa/main/atifragshader.c
@@ -494,7 +494,7 @@ _mesa_PassTexCoordATI(GLuint dst, GLuint coord, GLenum swizzle)
}
}
- curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI);
+ curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI);
new_tex_inst(curProg);
/* add the instructions */
@@ -567,7 +567,7 @@ _mesa_SampleMapATI(GLuint dst, GLuint interp, GLenum swizzle)
}
}
- curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI);
+ curProg->regsAssigned[curProg->cur_pass >> 1] |= 1 << (dst - GL_REG_0_ATI);
new_tex_inst(curProg);
/* add the instructions */
diff --git a/mesalib/src/mesa/main/buffers.c b/mesalib/src/mesa/main/buffers.c
index 928450f0f..63f53e2b0 100644
--- a/mesalib/src/mesa/main/buffers.c
+++ b/mesalib/src/mesa/main/buffers.c
@@ -1,526 +1,542 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file buffers.c
- * glReadBuffer, DrawBuffer functions.
- */
-
-
-
-#include "glheader.h"
-#include "buffers.h"
-#include "colormac.h"
-#include "context.h"
-#include "enums.h"
-#include "mtypes.h"
-
-
-#define BAD_MASK ~0u
-
-
-/**
- * Return bitmask of BUFFER_BIT_* flags indicating which color buffers are
- * available to the rendering context (for drawing or reading).
- * This depends on the type of framebuffer. For window system framebuffers
- * we look at the framebuffer's visual. But for user-create framebuffers we
- * look at the number of supported color attachments.
- * \param fb the framebuffer to draw to, or read from
- * \return bitmask of BUFFER_BIT_* flags
- */
-static GLbitfield
-supported_buffer_bitmask(const struct gl_context *ctx, const struct gl_framebuffer *fb)
-{
- GLbitfield mask = 0x0;
-
- if (fb->Name > 0) {
- /* A user-created renderbuffer */
- GLuint i;
- ASSERT(ctx->Extensions.EXT_framebuffer_object);
- for (i = 0; i < ctx->Const.MaxColorAttachments; i++) {
- mask |= (BUFFER_BIT_COLOR0 << i);
- }
- }
- else {
- /* A window system framebuffer */
- GLint i;
- mask = BUFFER_BIT_FRONT_LEFT; /* always have this */
- if (fb->Visual.stereoMode) {
- mask |= BUFFER_BIT_FRONT_RIGHT;
- if (fb->Visual.doubleBufferMode) {
- mask |= BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT;
- }
- }
- else if (fb->Visual.doubleBufferMode) {
- mask |= BUFFER_BIT_BACK_LEFT;
- }
-
- for (i = 0; i < fb->Visual.numAuxBuffers; i++) {
- mask |= (BUFFER_BIT_AUX0 << i);
- }
- }
-
- return mask;
-}
-
-
-/**
- * Helper routine used by glDrawBuffer and glDrawBuffersARB.
- * Given a GLenum naming one or more color buffers (such as
- * GL_FRONT_AND_BACK), return the corresponding bitmask of BUFFER_BIT_* flags.
- */
-static GLbitfield
-draw_buffer_enum_to_bitmask(GLenum buffer)
-{
- switch (buffer) {
- case GL_NONE:
- return 0;
- case GL_FRONT:
- return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT;
- case GL_BACK:
- return BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT;
- case GL_RIGHT:
- return BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT;
- case GL_FRONT_RIGHT:
- return BUFFER_BIT_FRONT_RIGHT;
- case GL_BACK_RIGHT:
- return BUFFER_BIT_BACK_RIGHT;
- case GL_BACK_LEFT:
- return BUFFER_BIT_BACK_LEFT;
- case GL_FRONT_AND_BACK:
- return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT
- | BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT;
- case GL_LEFT:
- return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT;
- case GL_FRONT_LEFT:
- return BUFFER_BIT_FRONT_LEFT;
- case GL_AUX0:
- return BUFFER_BIT_AUX0;
- case GL_AUX1:
- case GL_AUX2:
- case GL_AUX3:
- return 1 << BUFFER_COUNT; /* invalid, but not BAD_MASK */
- case GL_COLOR_ATTACHMENT0_EXT:
- return BUFFER_BIT_COLOR0;
- case GL_COLOR_ATTACHMENT1_EXT:
- return BUFFER_BIT_COLOR1;
- case GL_COLOR_ATTACHMENT2_EXT:
- return BUFFER_BIT_COLOR2;
- case GL_COLOR_ATTACHMENT3_EXT:
- return BUFFER_BIT_COLOR3;
- case GL_COLOR_ATTACHMENT4_EXT:
- return BUFFER_BIT_COLOR4;
- case GL_COLOR_ATTACHMENT5_EXT:
- return BUFFER_BIT_COLOR5;
- case GL_COLOR_ATTACHMENT6_EXT:
- return BUFFER_BIT_COLOR6;
- case GL_COLOR_ATTACHMENT7_EXT:
- return BUFFER_BIT_COLOR7;
- default:
- /* error */
- return BAD_MASK;
- }
-}
-
-
-/**
- * Helper routine used by glReadBuffer.
- * Given a GLenum naming a color buffer, return the index of the corresponding
- * renderbuffer (a BUFFER_* value).
- * return -1 for an invalid buffer.
- */
-static GLint
-read_buffer_enum_to_index(GLenum buffer)
-{
- switch (buffer) {
- case GL_FRONT:
- return BUFFER_FRONT_LEFT;
- case GL_BACK:
- return BUFFER_BACK_LEFT;
- case GL_RIGHT:
- return BUFFER_FRONT_RIGHT;
- case GL_FRONT_RIGHT:
- return BUFFER_FRONT_RIGHT;
- case GL_BACK_RIGHT:
- return BUFFER_BACK_RIGHT;
- case GL_BACK_LEFT:
- return BUFFER_BACK_LEFT;
- case GL_LEFT:
- return BUFFER_FRONT_LEFT;
- case GL_FRONT_LEFT:
- return BUFFER_FRONT_LEFT;
- case GL_AUX0:
- return BUFFER_AUX0;
- case GL_AUX1:
- case GL_AUX2:
- case GL_AUX3:
- return BUFFER_COUNT; /* invalid, but not -1 */
- case GL_COLOR_ATTACHMENT0_EXT:
- return BUFFER_COLOR0;
- case GL_COLOR_ATTACHMENT1_EXT:
- return BUFFER_COLOR1;
- case GL_COLOR_ATTACHMENT2_EXT:
- return BUFFER_COLOR2;
- case GL_COLOR_ATTACHMENT3_EXT:
- return BUFFER_COLOR3;
- case GL_COLOR_ATTACHMENT4_EXT:
- return BUFFER_COLOR4;
- case GL_COLOR_ATTACHMENT5_EXT:
- return BUFFER_COLOR5;
- case GL_COLOR_ATTACHMENT6_EXT:
- return BUFFER_COLOR6;
- case GL_COLOR_ATTACHMENT7_EXT:
- return BUFFER_COLOR7;
- default:
- /* error */
- return -1;
- }
-}
-
-
-/**
- * Called by glDrawBuffer().
- * Specify which renderbuffer(s) to draw into for the first color output.
- * <buffer> can name zero, one, two or four renderbuffers!
- * \sa _mesa_DrawBuffersARB
- *
- * \param buffer buffer token such as GL_LEFT or GL_FRONT_AND_BACK, etc.
- *
- * Note that the behaviour of this function depends on whether the
- * current ctx->DrawBuffer is a window-system framebuffer (Name=0) or
- * a user-created framebuffer object (Name!=0).
- * In the former case, we update the per-context ctx->Color.DrawBuffer
- * state var _and_ the FB's ColorDrawBuffer state.
- * In the later case, we update the FB's ColorDrawBuffer state only.
- *
- * Furthermore, upon a MakeCurrent() or BindFramebuffer() call, if the
- * new FB is a window system FB, we need to re-update the FB's
- * ColorDrawBuffer state to match the context. This is handled in
- * _mesa_update_framebuffer().
- *
- * See the GL_EXT_framebuffer_object spec for more info.
- */
-void GLAPIENTRY
-_mesa_DrawBuffer(GLenum buffer)
-{
- GLbitfield destMask;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */
-
- if (MESA_VERBOSE & VERBOSE_API) {
- _mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
- }
-
- if (buffer == GL_NONE) {
- destMask = 0x0;
- }
- else {
- const GLbitfield supportedMask
- = supported_buffer_bitmask(ctx, ctx->DrawBuffer);
- destMask = draw_buffer_enum_to_bitmask(buffer);
- if (destMask == BAD_MASK) {
- /* totally bogus buffer */
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffer(buffer=0x%x)", buffer);
- return;
- }
- destMask &= supportedMask;
- if (destMask == 0x0) {
- /* none of the named color buffers exist! */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glDrawBuffer(buffer=0x%x)", buffer);
- return;
- }
- }
-
- /* if we get here, there's no error so set new state */
- _mesa_drawbuffers(ctx, 1, &buffer, &destMask);
-
- /*
- * Call device driver function.
- */
- if (ctx->Driver.DrawBuffers)
- ctx->Driver.DrawBuffers(ctx, 1, &buffer);
- else if (ctx->Driver.DrawBuffer)
- ctx->Driver.DrawBuffer(ctx, buffer);
-}
-
-
-/**
- * Called by glDrawBuffersARB; specifies the destination color renderbuffers
- * for N fragment program color outputs.
- * \sa _mesa_DrawBuffer
- * \param n number of outputs
- * \param buffers array [n] of renderbuffer names. Unlike glDrawBuffer, the
- * names cannot specify more than one buffer. For example,
- * GL_FRONT_AND_BACK is illegal.
- */
-void GLAPIENTRY
-_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers)
-{
- GLint output;
- GLbitfield usedBufferMask, supportedMask;
- GLbitfield destMask[MAX_DRAW_BUFFERS];
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- /* Turns out n==0 is a valid input that should not produce an error.
- * The remaining code below correctly handles the n==0 case.
- */
- if (n < 0 || n > (GLsizei) ctx->Const.MaxDrawBuffers) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)");
- return;
- }
-
- supportedMask = supported_buffer_bitmask(ctx, ctx->DrawBuffer);
- usedBufferMask = 0x0;
-
- /* complicated error checking... */
- for (output = 0; output < n; output++) {
- if (buffers[output] == GL_NONE) {
- destMask[output] = 0x0;
- }
- else {
- destMask[output] = draw_buffer_enum_to_bitmask(buffers[output]);
- if (destMask[output] == BAD_MASK
- || _mesa_bitcount(destMask[output]) > 1) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffersARB(buffer)");
- return;
- }
- destMask[output] &= supportedMask;
- if (destMask[output] == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glDrawBuffersARB(unsupported buffer)");
- return;
- }
- if (destMask[output] & usedBufferMask) {
- /* can't specify a dest buffer more than once! */
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glDrawBuffersARB(duplicated buffer)");
- return;
- }
-
- /* update bitmask */
- usedBufferMask |= destMask[output];
- }
- }
-
- /* OK, if we get here, there were no errors so set the new state */
- _mesa_drawbuffers(ctx, n, buffers, destMask);
-
- /*
- * Call device driver function. Note that n can be equal to 0,
- * in which case we don't want to reference buffers[0], which
- * may not be valid.
- */
- if (ctx->Driver.DrawBuffers)
- ctx->Driver.DrawBuffers(ctx, n, buffers);
- else if (ctx->Driver.DrawBuffer)
- ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE);
-}
-
-
-/**
- * Helper function to set the GL_DRAW_BUFFER state in the context and
- * current FBO. Called via glDrawBuffer(), glDrawBuffersARB()
- *
- * All error checking will have been done prior to calling this function
- * so nothing should go wrong at this point.
- *
- * \param ctx current context
- * \param n number of color outputs to set
- * \param buffers array[n] of colorbuffer names, like GL_LEFT.
- * \param destMask array[n] of BUFFER_BIT_* bitmasks which correspond to the
- * colorbuffer names. (i.e. GL_FRONT_AND_BACK =>
- * BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT).
- */
-void
-_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
- const GLbitfield *destMask)
-{
- struct gl_framebuffer *fb = ctx->DrawBuffer;
- GLbitfield mask[MAX_DRAW_BUFFERS];
- GLboolean newState = GL_FALSE;
-
- if (!destMask) {
- /* compute destMask values now */
- const GLbitfield supportedMask = supported_buffer_bitmask(ctx, fb);
- GLuint output;
- for (output = 0; output < n; output++) {
- mask[output] = draw_buffer_enum_to_bitmask(buffers[output]);
- ASSERT(mask[output] != BAD_MASK);
- mask[output] &= supportedMask;
- }
- destMask = mask;
- }
-
- /*
- * If n==1, destMask[0] may have up to four bits set.
- * Otherwise, destMask[x] can only have one bit set.
- */
- if (n == 1) {
- GLuint count = 0, destMask0 = destMask[0];
- while (destMask0) {
- GLint bufIndex = _mesa_ffs(destMask0) - 1;
- if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {
- fb->_ColorDrawBufferIndexes[count] = bufIndex;
- newState = GL_TRUE;
- }
- count++;
- destMask0 &= ~(1 << bufIndex);
- }
- fb->ColorDrawBuffer[0] = buffers[0];
- if (fb->_NumColorDrawBuffers != count) {
- fb->_NumColorDrawBuffers = count;
- newState = GL_TRUE;
- }
- }
- else {
- GLuint buf, count = 0;
- for (buf = 0; buf < n; buf++ ) {
- if (destMask[buf]) {
- GLint bufIndex = _mesa_ffs(destMask[buf]) - 1;
- /* only one bit should be set in the destMask[buf] field */
- ASSERT(_mesa_bitcount(destMask[buf]) == 1);
- if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) {
- fb->_ColorDrawBufferIndexes[buf] = bufIndex;
- newState = GL_TRUE;
- }
- count = buf + 1;
- }
- else {
- if (fb->_ColorDrawBufferIndexes[buf] != -1) {
- fb->_ColorDrawBufferIndexes[buf] = -1;
- newState = GL_TRUE;
- }
- }
- fb->ColorDrawBuffer[buf] = buffers[buf];
- }
- /* set remaining outputs to -1 (GL_NONE) */
- while (buf < ctx->Const.MaxDrawBuffers) {
- if (fb->_ColorDrawBufferIndexes[buf] != -1) {
- fb->_ColorDrawBufferIndexes[buf] = -1;
- newState = GL_TRUE;
- }
- fb->ColorDrawBuffer[buf] = GL_NONE;
- buf++;
- }
- fb->_NumColorDrawBuffers = count;
- }
-
- if (fb->Name == 0) {
- /* also set context drawbuffer state */
- GLuint buf;
- for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
- if (ctx->Color.DrawBuffer[buf] != fb->ColorDrawBuffer[buf]) {
- ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf];
- newState = GL_TRUE;
- }
- }
- }
-
- if (newState)
- FLUSH_VERTICES(ctx, _NEW_BUFFERS);
-}
-
-
-/**
- * Like \sa _mesa_drawbuffers(), this is a helper function for setting
- * GL_READ_BUFFER state in the context and current FBO.
- * \param ctx the rendering context
- * \param buffer GL_FRONT, GL_BACK, GL_COLOR_ATTACHMENT0, etc.
- * \param bufferIndex the numerical index corresponding to 'buffer'
- */
-void
-_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex)
-{
- struct gl_framebuffer *fb = ctx->ReadBuffer;
-
- if (fb->Name == 0) {
- /* Only update the per-context READ_BUFFER state if we're bound to
- * a window-system framebuffer.
- */
- ctx->Pixel.ReadBuffer = buffer;
- }
-
- fb->ColorReadBuffer = buffer;
- fb->_ColorReadBufferIndex = bufferIndex;
-
- ctx->NewState |= _NEW_BUFFERS;
-}
-
-
-
-/**
- * Called by glReadBuffer to set the source renderbuffer for reading pixels.
- * \param mode color buffer such as GL_FRONT, GL_BACK, etc.
- */
-void GLAPIENTRY
-_mesa_ReadBuffer(GLenum buffer)
-{
- struct gl_framebuffer *fb;
- GLbitfield supportedMask;
- GLint srcBuffer;
- GET_CURRENT_CONTEXT(ctx);
- ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
-
- fb = ctx->ReadBuffer;
-
- if (MESA_VERBOSE & VERBOSE_API)
- _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
-
- if (fb->Name > 0 && buffer == GL_NONE) {
- /* This is legal for user-created framebuffer objects */
- srcBuffer = -1;
- }
- else {
- /* general case / window-system framebuffer */
- srcBuffer = read_buffer_enum_to_index(buffer);
- if (srcBuffer == -1) {
- _mesa_error(ctx, GL_INVALID_ENUM,
- "glReadBuffer(buffer=0x%x)", buffer);
- return;
- }
- supportedMask = supported_buffer_bitmask(ctx, fb);
- if (((1 << srcBuffer) & supportedMask) == 0) {
- _mesa_error(ctx, GL_INVALID_OPERATION,
- "glReadBuffer(buffer=0x%x)", buffer);
- return;
- }
- }
-
- /* OK, all error checking has been completed now */
-
- _mesa_readbuffer(ctx, buffer, srcBuffer);
- ctx->NewState |= _NEW_BUFFERS;
-
- /*
- * Call device driver function.
- */
- if (ctx->Driver.ReadBuffer)
- (*ctx->Driver.ReadBuffer)(ctx, buffer);
-}
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file buffers.c
+ * glReadBuffer, DrawBuffer functions.
+ */
+
+
+
+#include "glheader.h"
+#include "buffers.h"
+#include "colormac.h"
+#include "context.h"
+#include "enums.h"
+#include "mtypes.h"
+
+
+#define BAD_MASK ~0u
+
+
+/**
+ * Return bitmask of BUFFER_BIT_* flags indicating which color buffers are
+ * available to the rendering context (for drawing or reading).
+ * This depends on the type of framebuffer. For window system framebuffers
+ * we look at the framebuffer's visual. But for user-create framebuffers we
+ * look at the number of supported color attachments.
+ * \param fb the framebuffer to draw to, or read from
+ * \return bitmask of BUFFER_BIT_* flags
+ */
+static GLbitfield
+supported_buffer_bitmask(const struct gl_context *ctx, const struct gl_framebuffer *fb)
+{
+ GLbitfield mask = 0x0;
+
+ if (fb->Name > 0) {
+ /* A user-created renderbuffer */
+ GLuint i;
+ ASSERT(ctx->Extensions.EXT_framebuffer_object);
+ for (i = 0; i < ctx->Const.MaxColorAttachments; i++) {
+ mask |= (BUFFER_BIT_COLOR0 << i);
+ }
+ }
+ else {
+ /* A window system framebuffer */
+ GLint i;
+ mask = BUFFER_BIT_FRONT_LEFT; /* always have this */
+ if (fb->Visual.stereoMode) {
+ mask |= BUFFER_BIT_FRONT_RIGHT;
+ if (fb->Visual.doubleBufferMode) {
+ mask |= BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT;
+ }
+ }
+ else if (fb->Visual.doubleBufferMode) {
+ mask |= BUFFER_BIT_BACK_LEFT;
+ }
+
+ for (i = 0; i < fb->Visual.numAuxBuffers; i++) {
+ mask |= (BUFFER_BIT_AUX0 << i);
+ }
+ }
+
+ return mask;
+}
+
+
+/**
+ * Helper routine used by glDrawBuffer and glDrawBuffersARB.
+ * Given a GLenum naming one or more color buffers (such as
+ * GL_FRONT_AND_BACK), return the corresponding bitmask of BUFFER_BIT_* flags.
+ */
+static GLbitfield
+draw_buffer_enum_to_bitmask(GLenum buffer)
+{
+ switch (buffer) {
+ case GL_NONE:
+ return 0;
+ case GL_FRONT:
+ return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT;
+ case GL_BACK:
+ return BUFFER_BIT_BACK_LEFT | BUFFER_BIT_BACK_RIGHT;
+ case GL_RIGHT:
+ return BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT;
+ case GL_FRONT_RIGHT:
+ return BUFFER_BIT_FRONT_RIGHT;
+ case GL_BACK_RIGHT:
+ return BUFFER_BIT_BACK_RIGHT;
+ case GL_BACK_LEFT:
+ return BUFFER_BIT_BACK_LEFT;
+ case GL_FRONT_AND_BACK:
+ return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT
+ | BUFFER_BIT_FRONT_RIGHT | BUFFER_BIT_BACK_RIGHT;
+ case GL_LEFT:
+ return BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT;
+ case GL_FRONT_LEFT:
+ return BUFFER_BIT_FRONT_LEFT;
+ case GL_AUX0:
+ return BUFFER_BIT_AUX0;
+ case GL_AUX1:
+ case GL_AUX2:
+ case GL_AUX3:
+ return 1 << BUFFER_COUNT; /* invalid, but not BAD_MASK */
+ case GL_COLOR_ATTACHMENT0_EXT:
+ return BUFFER_BIT_COLOR0;
+ case GL_COLOR_ATTACHMENT1_EXT:
+ return BUFFER_BIT_COLOR1;
+ case GL_COLOR_ATTACHMENT2_EXT:
+ return BUFFER_BIT_COLOR2;
+ case GL_COLOR_ATTACHMENT3_EXT:
+ return BUFFER_BIT_COLOR3;
+ case GL_COLOR_ATTACHMENT4_EXT:
+ return BUFFER_BIT_COLOR4;
+ case GL_COLOR_ATTACHMENT5_EXT:
+ return BUFFER_BIT_COLOR5;
+ case GL_COLOR_ATTACHMENT6_EXT:
+ return BUFFER_BIT_COLOR6;
+ case GL_COLOR_ATTACHMENT7_EXT:
+ return BUFFER_BIT_COLOR7;
+ default:
+ /* error */
+ return BAD_MASK;
+ }
+}
+
+
+/**
+ * Helper routine used by glReadBuffer.
+ * Given a GLenum naming a color buffer, return the index of the corresponding
+ * renderbuffer (a BUFFER_* value).
+ * return -1 for an invalid buffer.
+ */
+static GLint
+read_buffer_enum_to_index(GLenum buffer)
+{
+ switch (buffer) {
+ case GL_FRONT:
+ return BUFFER_FRONT_LEFT;
+ case GL_BACK:
+ return BUFFER_BACK_LEFT;
+ case GL_RIGHT:
+ return BUFFER_FRONT_RIGHT;
+ case GL_FRONT_RIGHT:
+ return BUFFER_FRONT_RIGHT;
+ case GL_BACK_RIGHT:
+ return BUFFER_BACK_RIGHT;
+ case GL_BACK_LEFT:
+ return BUFFER_BACK_LEFT;
+ case GL_LEFT:
+ return BUFFER_FRONT_LEFT;
+ case GL_FRONT_LEFT:
+ return BUFFER_FRONT_LEFT;
+ case GL_AUX0:
+ return BUFFER_AUX0;
+ case GL_AUX1:
+ case GL_AUX2:
+ case GL_AUX3:
+ return BUFFER_COUNT; /* invalid, but not -1 */
+ case GL_COLOR_ATTACHMENT0_EXT:
+ return BUFFER_COLOR0;
+ case GL_COLOR_ATTACHMENT1_EXT:
+ return BUFFER_COLOR1;
+ case GL_COLOR_ATTACHMENT2_EXT:
+ return BUFFER_COLOR2;
+ case GL_COLOR_ATTACHMENT3_EXT:
+ return BUFFER_COLOR3;
+ case GL_COLOR_ATTACHMENT4_EXT:
+ return BUFFER_COLOR4;
+ case GL_COLOR_ATTACHMENT5_EXT:
+ return BUFFER_COLOR5;
+ case GL_COLOR_ATTACHMENT6_EXT:
+ return BUFFER_COLOR6;
+ case GL_COLOR_ATTACHMENT7_EXT:
+ return BUFFER_COLOR7;
+ default:
+ /* error */
+ return -1;
+ }
+}
+
+
+/**
+ * Called by glDrawBuffer().
+ * Specify which renderbuffer(s) to draw into for the first color output.
+ * <buffer> can name zero, one, two or four renderbuffers!
+ * \sa _mesa_DrawBuffersARB
+ *
+ * \param buffer buffer token such as GL_LEFT or GL_FRONT_AND_BACK, etc.
+ *
+ * Note that the behaviour of this function depends on whether the
+ * current ctx->DrawBuffer is a window-system framebuffer (Name=0) or
+ * a user-created framebuffer object (Name!=0).
+ * In the former case, we update the per-context ctx->Color.DrawBuffer
+ * state var _and_ the FB's ColorDrawBuffer state.
+ * In the later case, we update the FB's ColorDrawBuffer state only.
+ *
+ * Furthermore, upon a MakeCurrent() or BindFramebuffer() call, if the
+ * new FB is a window system FB, we need to re-update the FB's
+ * ColorDrawBuffer state to match the context. This is handled in
+ * _mesa_update_framebuffer().
+ *
+ * See the GL_EXT_framebuffer_object spec for more info.
+ */
+void GLAPIENTRY
+_mesa_DrawBuffer(GLenum buffer)
+{
+ GLbitfield destMask;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); /* too complex... */
+
+ if (MESA_VERBOSE & VERBOSE_API) {
+ _mesa_debug(ctx, "glDrawBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
+ }
+
+ if (buffer == GL_NONE) {
+ destMask = 0x0;
+ }
+ else {
+ const GLbitfield supportedMask
+ = supported_buffer_bitmask(ctx, ctx->DrawBuffer);
+ destMask = draw_buffer_enum_to_bitmask(buffer);
+ if (destMask == BAD_MASK) {
+ /* totally bogus buffer */
+ _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffer(buffer=0x%x)", buffer);
+ return;
+ }
+ destMask &= supportedMask;
+ if (destMask == 0x0) {
+ /* none of the named color buffers exist! */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawBuffer(buffer=0x%x)", buffer);
+ return;
+ }
+ }
+
+ /* if we get here, there's no error so set new state */
+ _mesa_drawbuffers(ctx, 1, &buffer, &destMask);
+
+ /*
+ * Call device driver function.
+ */
+ if (ctx->Driver.DrawBuffers)
+ ctx->Driver.DrawBuffers(ctx, 1, &buffer);
+ else if (ctx->Driver.DrawBuffer)
+ ctx->Driver.DrawBuffer(ctx, buffer);
+}
+
+
+/**
+ * Called by glDrawBuffersARB; specifies the destination color renderbuffers
+ * for N fragment program color outputs.
+ * \sa _mesa_DrawBuffer
+ * \param n number of outputs
+ * \param buffers array [n] of renderbuffer names. Unlike glDrawBuffer, the
+ * names cannot specify more than one buffer. For example,
+ * GL_FRONT_AND_BACK is illegal.
+ */
+void GLAPIENTRY
+_mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers)
+{
+ GLint output;
+ GLbitfield usedBufferMask, supportedMask;
+ GLbitfield destMask[MAX_DRAW_BUFFERS];
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ /* Turns out n==0 is a valid input that should not produce an error.
+ * The remaining code below correctly handles the n==0 case.
+ */
+ if (n < 0 || n > (GLsizei) ctx->Const.MaxDrawBuffers) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)");
+ return;
+ }
+
+ supportedMask = supported_buffer_bitmask(ctx, ctx->DrawBuffer);
+ usedBufferMask = 0x0;
+
+ /* complicated error checking... */
+ for (output = 0; output < n; output++) {
+ if (buffers[output] == GL_NONE) {
+ destMask[output] = 0x0;
+ }
+ else {
+ destMask[output] = draw_buffer_enum_to_bitmask(buffers[output]);
+ if (destMask[output] == BAD_MASK
+ || _mesa_bitcount(destMask[output]) > 1) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffersARB(buffer)");
+ return;
+ }
+ destMask[output] &= supportedMask;
+ if (destMask[output] == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawBuffersARB(unsupported buffer)");
+ return;
+ }
+ if (destMask[output] & usedBufferMask) {
+ /* can't specify a dest buffer more than once! */
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glDrawBuffersARB(duplicated buffer)");
+ return;
+ }
+
+ /* update bitmask */
+ usedBufferMask |= destMask[output];
+ }
+ }
+
+ /* OK, if we get here, there were no errors so set the new state */
+ _mesa_drawbuffers(ctx, n, buffers, destMask);
+
+ /*
+ * Call device driver function. Note that n can be equal to 0,
+ * in which case we don't want to reference buffers[0], which
+ * may not be valid.
+ */
+ if (ctx->Driver.DrawBuffers)
+ ctx->Driver.DrawBuffers(ctx, n, buffers);
+ else if (ctx->Driver.DrawBuffer)
+ ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE);
+}
+
+/**
+ * Performs necessary state updates when _mesa_drawbuffers makes an
+ * actual change.
+ */
+static void
+updated_drawbuffers(struct gl_context *ctx)
+{
+ FLUSH_VERTICES(ctx, _NEW_BUFFERS);
+
+#if FEATURE_GL
+ if (ctx->API == API_OPENGL && !ctx->Extensions.ARB_ES2_compatibility) {
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+ /* Flag the FBO as requiring validation. */
+ if (fb->Name != 0) {
+ fb->_Status = 0;
+ }
+ }
+#endif
+}
+
+/**
+ * Helper function to set the GL_DRAW_BUFFER state in the context and
+ * current FBO. Called via glDrawBuffer(), glDrawBuffersARB()
+ *
+ * All error checking will have been done prior to calling this function
+ * so nothing should go wrong at this point.
+ *
+ * \param ctx current context
+ * \param n number of color outputs to set
+ * \param buffers array[n] of colorbuffer names, like GL_LEFT.
+ * \param destMask array[n] of BUFFER_BIT_* bitmasks which correspond to the
+ * colorbuffer names. (i.e. GL_FRONT_AND_BACK =>
+ * BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT).
+ */
+void
+_mesa_drawbuffers(struct gl_context *ctx, GLuint n, const GLenum *buffers,
+ const GLbitfield *destMask)
+{
+ struct gl_framebuffer *fb = ctx->DrawBuffer;
+ GLbitfield mask[MAX_DRAW_BUFFERS];
+
+ if (!destMask) {
+ /* compute destMask values now */
+ const GLbitfield supportedMask = supported_buffer_bitmask(ctx, fb);
+ GLuint output;
+ for (output = 0; output < n; output++) {
+ mask[output] = draw_buffer_enum_to_bitmask(buffers[output]);
+ ASSERT(mask[output] != BAD_MASK);
+ mask[output] &= supportedMask;
+ }
+ destMask = mask;
+ }
+
+ /*
+ * If n==1, destMask[0] may have up to four bits set.
+ * Otherwise, destMask[x] can only have one bit set.
+ */
+ if (n == 1) {
+ GLuint count = 0, destMask0 = destMask[0];
+ while (destMask0) {
+ GLint bufIndex = _mesa_ffs(destMask0) - 1;
+ if (fb->_ColorDrawBufferIndexes[count] != bufIndex) {
+ updated_drawbuffers(ctx);
+ fb->_ColorDrawBufferIndexes[count] = bufIndex;
+ }
+ count++;
+ destMask0 &= ~(1 << bufIndex);
+ }
+ fb->ColorDrawBuffer[0] = buffers[0];
+ if (fb->_NumColorDrawBuffers != count) {
+ updated_drawbuffers(ctx);
+ fb->_NumColorDrawBuffers = count;
+ }
+ }
+ else {
+ GLuint buf, count = 0;
+ for (buf = 0; buf < n; buf++ ) {
+ if (destMask[buf]) {
+ GLint bufIndex = _mesa_ffs(destMask[buf]) - 1;
+ /* only one bit should be set in the destMask[buf] field */
+ ASSERT(_mesa_bitcount(destMask[buf]) == 1);
+ if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) {
+ updated_drawbuffers(ctx);
+ fb->_ColorDrawBufferIndexes[buf] = bufIndex;
+ }
+ count = buf + 1;
+ }
+ else {
+ if (fb->_ColorDrawBufferIndexes[buf] != -1) {
+ updated_drawbuffers(ctx);
+ fb->_ColorDrawBufferIndexes[buf] = -1;
+ }
+ }
+ fb->ColorDrawBuffer[buf] = buffers[buf];
+ }
+ /* set remaining outputs to -1 (GL_NONE) */
+ while (buf < ctx->Const.MaxDrawBuffers) {
+ if (fb->_ColorDrawBufferIndexes[buf] != -1) {
+ updated_drawbuffers(ctx);
+ fb->_ColorDrawBufferIndexes[buf] = -1;
+ }
+ fb->ColorDrawBuffer[buf] = GL_NONE;
+ buf++;
+ }
+ fb->_NumColorDrawBuffers = count;
+ }
+
+ if (fb->Name == 0) {
+ /* also set context drawbuffer state */
+ GLuint buf;
+ for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) {
+ if (ctx->Color.DrawBuffer[buf] != fb->ColorDrawBuffer[buf]) {
+ updated_drawbuffers(ctx);
+ ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf];
+ }
+ }
+ }
+}
+
+
+/**
+ * Like \sa _mesa_drawbuffers(), this is a helper function for setting
+ * GL_READ_BUFFER state in the context and current FBO.
+ * \param ctx the rendering context
+ * \param buffer GL_FRONT, GL_BACK, GL_COLOR_ATTACHMENT0, etc.
+ * \param bufferIndex the numerical index corresponding to 'buffer'
+ */
+void
+_mesa_readbuffer(struct gl_context *ctx, GLenum buffer, GLint bufferIndex)
+{
+ struct gl_framebuffer *fb = ctx->ReadBuffer;
+
+ if (fb->Name == 0) {
+ /* Only update the per-context READ_BUFFER state if we're bound to
+ * a window-system framebuffer.
+ */
+ ctx->Pixel.ReadBuffer = buffer;
+ }
+
+ fb->ColorReadBuffer = buffer;
+ fb->_ColorReadBufferIndex = bufferIndex;
+
+ ctx->NewState |= _NEW_BUFFERS;
+}
+
+
+
+/**
+ * Called by glReadBuffer to set the source renderbuffer for reading pixels.
+ * \param mode color buffer such as GL_FRONT, GL_BACK, etc.
+ */
+void GLAPIENTRY
+_mesa_ReadBuffer(GLenum buffer)
+{
+ struct gl_framebuffer *fb;
+ GLbitfield supportedMask;
+ GLint srcBuffer;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
+
+ fb = ctx->ReadBuffer;
+
+ if (MESA_VERBOSE & VERBOSE_API)
+ _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
+
+ if (fb->Name > 0 && buffer == GL_NONE) {
+ /* This is legal for user-created framebuffer objects */
+ srcBuffer = -1;
+ }
+ else {
+ /* general case / window-system framebuffer */
+ srcBuffer = read_buffer_enum_to_index(buffer);
+ if (srcBuffer == -1) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glReadBuffer(buffer=0x%x)", buffer);
+ return;
+ }
+ supportedMask = supported_buffer_bitmask(ctx, fb);
+ if (((1 << srcBuffer) & supportedMask) == 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glReadBuffer(buffer=0x%x)", buffer);
+ return;
+ }
+ }
+
+ /* OK, all error checking has been completed now */
+
+ _mesa_readbuffer(ctx, buffer, srcBuffer);
+ ctx->NewState |= _NEW_BUFFERS;
+
+ /*
+ * Call device driver function.
+ */
+ if (ctx->Driver.ReadBuffer)
+ (*ctx->Driver.ReadBuffer)(ctx, buffer);
+}
diff --git a/mesalib/src/mesa/main/dlist.c b/mesalib/src/mesa/main/dlist.c
index b9c29cb84..0b300448e 100644
--- a/mesalib/src/mesa/main/dlist.c
+++ b/mesalib/src/mesa/main/dlist.c
@@ -57,6 +57,9 @@
#include "pack.h"
#include "pbo.h"
#include "queryobj.h"
+#include "samplerobj.h"
+#include "shaderapi.h"
+#include "syncobj.h"
#include "teximage.h"
#include "mtypes.h"
#include "varray.h"
@@ -421,6 +424,10 @@ typedef enum
/* GL_EXT_transform_feedback */
OPCODE_BEGIN_TRANSFORM_FEEDBACK,
OPCODE_END_TRANSFORM_FEEDBACK,
+ OPCODE_BIND_TRANSFORM_FEEDBACK,
+ OPCODE_PAUSE_TRANSFORM_FEEDBACK,
+ OPCODE_RESUME_TRANSFORM_FEEDBACK,
+ OPCODE_DRAW_TRANSFORM_FEEDBACK,
/* GL_EXT_texture_integer */
OPCODE_CLEARCOLOR_I,
@@ -440,6 +447,18 @@ typedef enum
/* GL_ARB_sampler_object */
OPCODE_BIND_SAMPLER,
+ OPCODE_SAMPLER_PARAMETERIV,
+ OPCODE_SAMPLER_PARAMETERFV,
+ OPCODE_SAMPLER_PARAMETERIIV,
+ OPCODE_SAMPLER_PARAMETERUIV,
+
+ /* GL_ARB_geometry_shader4 */
+ OPCODE_PROGRAM_PARAMETERI,
+ OPCODE_FRAMEBUFFER_TEXTURE,
+ OPCODE_FRAMEBUFFER_TEXTURE_FACE,
+
+ /* GL_ARB_sync */
+ OPCODE_WAIT_SYNC,
/* The following three are meta instructions */
OPCODE_ERROR, /* raise compiled-in error */
@@ -482,6 +501,17 @@ typedef union gl_dlist_node Node;
/**
+ * Used to store a 64-bit uint in a pair of "Nodes" for the sake of 32-bit
+ * environment. In 64-bit env, sizeof(Node)==8 anyway.
+ */
+union uint64_pair
+{
+ GLuint64 uint64;
+ GLuint uint32[2];
+};
+
+
+/**
* How many nodes to allocate at a time.
*
* \note Reduced now that we hold vertices etc. elsewhere.
@@ -6263,6 +6293,69 @@ save_EndTransformFeedback(void)
}
}
+static void GLAPIENTRY
+save_TransformFeedbackVaryings(GLuint program, GLsizei count,
+ const GLchar **varyings, GLenum bufferMode)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_problem(ctx,
+ "glTransformFeedbackVarying() display list support not done");
+}
+
+static void GLAPIENTRY
+save_BindTransformFeedback(GLenum target, GLuint name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_BIND_TRANSFORM_FEEDBACK, 2);
+ if (n) {
+ n[1].e = target;
+ n[2].ui = name;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_BindTransformFeedback(ctx->Exec, (target, name));
+ }
+}
+
+static void GLAPIENTRY
+save_PauseTransformFeedback(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ (void) alloc_instruction(ctx, OPCODE_PAUSE_TRANSFORM_FEEDBACK, 0);
+ if (ctx->ExecuteFlag) {
+ CALL_PauseTransformFeedback(ctx->Exec, ());
+ }
+}
+
+static void GLAPIENTRY
+save_ResumeTransformFeedback(void)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ (void) alloc_instruction(ctx, OPCODE_RESUME_TRANSFORM_FEEDBACK, 0);
+ if (ctx->ExecuteFlag) {
+ CALL_ResumeTransformFeedback(ctx->Exec, ());
+ }
+}
+
+static void GLAPIENTRY
+save_DrawTransformFeedback(GLenum mode, GLuint name)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_DRAW_TRANSFORM_FEEDBACK, 2);
+ if (n) {
+ n[1].e = mode;
+ n[2].ui = name;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_DrawTransformFeedback(ctx->Exec, (mode, name));
+ }
+}
+
/* aka UseProgram() */
static void GLAPIENTRY
@@ -7087,6 +7180,198 @@ save_BindSampler(GLuint unit, GLuint sampler)
}
}
+static void GLAPIENTRY
+save_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
+{
+ Node *n;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIV, 6);
+ if (n) {
+ n[1].ui = sampler;
+ n[2].e = pname;
+ n[3].i = params[0];
+ if (pname == GL_TEXTURE_BORDER_COLOR) {
+ n[4].i = params[1];
+ n[5].i = params[2];
+ n[6].i = params[3];
+ }
+ else {
+ n[4].i = n[5].i = n[6].i = 0;
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_SamplerParameteriv(ctx->Exec, (sampler, pname, params));
+ }
+}
+
+static void GLAPIENTRY
+save_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+{
+ save_SamplerParameteriv(sampler, pname, &param);
+}
+
+static void GLAPIENTRY
+save_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
+{
+ Node *n;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERFV, 6);
+ if (n) {
+ n[1].ui = sampler;
+ n[2].e = pname;
+ n[3].f = params[0];
+ if (pname == GL_TEXTURE_BORDER_COLOR) {
+ n[4].f = params[1];
+ n[5].f = params[2];
+ n[6].f = params[3];
+ }
+ else {
+ n[4].f = n[5].f = n[6].f = 0.0F;
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_SamplerParameterfv(ctx->Exec, (sampler, pname, params));
+ }
+}
+
+static void GLAPIENTRY
+save_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+{
+ save_SamplerParameterfv(sampler, pname, &param);
+}
+
+static void GLAPIENTRY
+save_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
+{
+ Node *n;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERIIV, 6);
+ if (n) {
+ n[1].ui = sampler;
+ n[2].e = pname;
+ n[3].i = params[0];
+ if (pname == GL_TEXTURE_BORDER_COLOR) {
+ n[4].i = params[1];
+ n[5].i = params[2];
+ n[6].i = params[3];
+ }
+ else {
+ n[4].i = n[5].i = n[6].i = 0;
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_SamplerParameterIiv(ctx->Exec, (sampler, pname, params));
+ }
+}
+
+static void GLAPIENTRY
+save_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
+{
+ Node *n;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_SAMPLER_PARAMETERUIV, 6);
+ if (n) {
+ n[1].ui = sampler;
+ n[2].e = pname;
+ n[3].ui = params[0];
+ if (pname == GL_TEXTURE_BORDER_COLOR) {
+ n[4].ui = params[1];
+ n[5].ui = params[2];
+ n[6].ui = params[3];
+ }
+ else {
+ n[4].ui = n[5].ui = n[6].ui = 0;
+ }
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_SamplerParameterIuiv(ctx->Exec, (sampler, pname, params));
+ }
+}
+
+/* GL_ARB_geometry_shader4 */
+static void GLAPIENTRY
+save_ProgramParameteri(GLuint program, GLenum pname, GLint value)
+{
+ Node *n;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_PROGRAM_PARAMETERI, 3);
+ if (n) {
+ n[1].ui = program;
+ n[2].e = pname;
+ n[3].i = value;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_ProgramParameteriARB(ctx->Exec, (program, pname, value));
+ }
+}
+
+static void GLAPIENTRY
+save_FramebufferTexture(GLenum target, GLenum attachment,
+ GLuint texture, GLint level)
+{
+ Node *n;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_FRAMEBUFFER_TEXTURE, 4);
+ if (n) {
+ n[1].e = target;
+ n[2].e = attachment;
+ n[3].ui = texture;
+ n[4].i = level;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_FramebufferTextureARB(ctx->Exec, (target, attachment, texture, level));
+ }
+}
+
+static void GLAPIENTRY
+save_FramebufferTextureFace(GLenum target, GLenum attachment,
+ GLuint texture, GLint level, GLenum face)
+{
+ Node *n;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_FRAMEBUFFER_TEXTURE_FACE, 5);
+ if (n) {
+ n[1].e = target;
+ n[2].e = attachment;
+ n[3].ui = texture;
+ n[4].i = level;
+ n[5].e = face;
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_FramebufferTextureFaceARB(ctx->Exec, (target, attachment, texture,
+ level, face));
+ }
+}
+
+
+
+static void GLAPIENTRY
+save_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+{
+ Node *n;
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = alloc_instruction(ctx, OPCODE_WAIT_SYNC, 4);
+ if (n) {
+ union uint64_pair p;
+ p.uint64 = timeout;
+ n[1].data = sync;
+ n[2].e = flags;
+ n[3].ui = p.uint32[0];
+ n[4].ui = p.uint32[1];
+ }
+ if (ctx->ExecuteFlag) {
+ CALL_WaitSync(ctx->Exec, (sync, flags, timeout));
+ }
+}
+
/**
* Save an error-generating command into display list.
@@ -7715,12 +8000,6 @@ execute_list(struct gl_context *ctx, GLuint list)
case OPCODE_PROVOKING_VERTEX:
CALL_ProvokingVertexEXT(ctx->Exec, (n[1].e));
break;
- case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
- CALL_BeginTransformFeedbackEXT(ctx->Exec, (n[1].e));
- break;
- case OPCODE_END_TRANSFORM_FEEDBACK:
- CALL_EndTransformFeedbackEXT(ctx->Exec, ());
- break;
case OPCODE_STENCIL_FUNC:
CALL_StencilFunc(ctx->Exec, (n[1].e, n[2].i, n[3].ui));
break;
@@ -8271,9 +8550,93 @@ execute_list(struct gl_context *ctx, GLuint list)
CALL_TextureBarrierNV(ctx->Exec, ());
break;
+ /* GL_EXT/ARB_transform_feedback */
+ case OPCODE_BEGIN_TRANSFORM_FEEDBACK:
+ CALL_BeginTransformFeedbackEXT(ctx->Exec, (n[1].e));
+ break;
+ case OPCODE_END_TRANSFORM_FEEDBACK:
+ CALL_EndTransformFeedbackEXT(ctx->Exec, ());
+ break;
+ case OPCODE_BIND_TRANSFORM_FEEDBACK:
+ CALL_BindTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
+ break;
+ case OPCODE_PAUSE_TRANSFORM_FEEDBACK:
+ CALL_PauseTransformFeedback(ctx->Exec, ());
+ break;
+ case OPCODE_RESUME_TRANSFORM_FEEDBACK:
+ CALL_ResumeTransformFeedback(ctx->Exec, ());
+ break;
+ case OPCODE_DRAW_TRANSFORM_FEEDBACK:
+ CALL_DrawTransformFeedback(ctx->Exec, (n[1].e, n[2].ui));
+ break;
+
+
case OPCODE_BIND_SAMPLER:
CALL_BindSampler(ctx->Exec, (n[1].ui, n[2].ui));
break;
+ case OPCODE_SAMPLER_PARAMETERIV:
+ {
+ GLint params[4];
+ params[0] = n[3].i;
+ params[1] = n[4].i;
+ params[2] = n[5].i;
+ params[3] = n[6].i;
+ CALL_SamplerParameteriv(ctx->Exec, (n[1].ui, n[2].e, params));
+ }
+ break;
+ case OPCODE_SAMPLER_PARAMETERFV:
+ {
+ GLfloat params[4];
+ params[0] = n[3].f;
+ params[1] = n[4].f;
+ params[2] = n[5].f;
+ params[3] = n[6].f;
+ CALL_SamplerParameterfv(ctx->Exec, (n[1].ui, n[2].e, params));
+ }
+ break;
+ case OPCODE_SAMPLER_PARAMETERIIV:
+ {
+ GLint params[4];
+ params[0] = n[3].i;
+ params[1] = n[4].i;
+ params[2] = n[5].i;
+ params[3] = n[6].i;
+ CALL_SamplerParameterIiv(ctx->Exec, (n[1].ui, n[2].e, params));
+ }
+ break;
+ case OPCODE_SAMPLER_PARAMETERUIV:
+ {
+ GLuint params[4];
+ params[0] = n[3].ui;
+ params[1] = n[4].ui;
+ params[2] = n[5].ui;
+ params[3] = n[6].ui;
+ CALL_SamplerParameterIuiv(ctx->Exec, (n[1].ui, n[2].e, params));
+ }
+ break;
+
+ /* GL_ARB_geometry_shader4 */
+ case OPCODE_PROGRAM_PARAMETERI:
+ CALL_ProgramParameteriARB(ctx->Exec, (n[1].ui, n[2].e, n[3].i));
+ break;
+ case OPCODE_FRAMEBUFFER_TEXTURE:
+ CALL_FramebufferTextureARB(ctx->Exec, (n[1].e, n[2].e,
+ n[3].ui, n[4].i));
+ break;
+ case OPCODE_FRAMEBUFFER_TEXTURE_FACE:
+ CALL_FramebufferTextureFaceARB(ctx->Exec, (n[1].e, n[2].e,
+ n[3].ui, n[4].i, n[5].e));
+ break;
+
+ /* GL_ARB_sync */
+ case OPCODE_WAIT_SYNC:
+ {
+ union uint64_pair p;
+ p.uint32[0] = n[3].ui;
+ p.uint32[1] = n[4].ui;
+ CALL_WaitSync(ctx->Exec, (n[1].data, n[2].bf, p.uint64));
+ }
+ break;
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
@@ -9741,6 +10104,10 @@ _mesa_create_save_table(void)
SET_GenVertexArraysAPPLE(table, _mesa_GenVertexArraysAPPLE);
SET_IsVertexArrayAPPLE(table, _mesa_IsVertexArrayAPPLE);
+ /* GL_ARB_vertex_array_object */
+ SET_BindVertexArray(table, _mesa_BindVertexArray);
+ SET_GenVertexArrays(table, _mesa_GenVertexArrays);
+
/* ???. GL_EXT_depth_bounds_test */
SET_DepthBoundsEXT(table, save_DepthBoundsEXT);
@@ -9823,15 +10190,11 @@ _mesa_create_save_table(void)
#endif
#if FEATURE_queryobj
+ _mesa_init_queryobj_dispatch(table); /* glGetQuery, etc */
SET_BeginQueryARB(table, save_BeginQueryARB);
SET_EndQueryARB(table, save_EndQueryARB);
- SET_GenQueriesARB(table, _mesa_GenQueriesARB);
- SET_DeleteQueriesARB(table, _mesa_DeleteQueriesARB);
- SET_IsQueryARB(table, _mesa_IsQueryARB);
- SET_GetQueryivARB(table, _mesa_GetQueryivARB);
- SET_GetQueryObjectivARB(table, _mesa_GetQueryObjectivARB);
- SET_GetQueryObjectuivARB(table, _mesa_GetQueryObjectuivARB);
#endif
+
SET_DrawBuffersARB(table, save_DrawBuffersARB);
#if FEATURE_EXT_framebuffer_blit
@@ -9839,6 +10202,7 @@ _mesa_create_save_table(void)
#endif
/* GL_ARB_shader_objects */
+ _mesa_init_shader_dispatch(table); /* Plug in glCreate/Delete/Get, etc */
SET_UseProgramObjectARB(table, save_UseProgramObjectARB);
SET_Uniform1fARB(table, save_Uniform1fARB);
SET_Uniform2fARB(table, save_Uniform2fARB);
@@ -9890,12 +10254,6 @@ _mesa_create_save_table(void)
/* ARB 59. GL_ARB_copy_buffer */
SET_CopyBufferSubData(table, _mesa_CopyBufferSubData); /* no dlist save */
- /* 352. GL_EXT_transform_feedback */
-#if FEATURE_EXT_transform_feedback
- SET_BeginTransformFeedbackEXT(table, save_BeginTransformFeedback);
- SET_EndTransformFeedbackEXT(table, save_EndTransformFeedback);
-#endif
-
/* 364. GL_EXT_provoking_vertex */
SET_ProvokingVertexEXT(table, save_ProvokingVertexEXT);
@@ -9903,6 +10261,7 @@ _mesa_create_save_table(void)
#if FEATURE_APPLE_object_purgeable
SET_ObjectPurgeableAPPLE(table, _mesa_ObjectPurgeableAPPLE);
SET_ObjectUnpurgeableAPPLE(table, _mesa_ObjectUnpurgeableAPPLE);
+ SET_GetObjectParameterivAPPLE(table, _mesa_GetObjectParameterivAPPLE);
#endif
/* GL_EXT_texture_integer */
@@ -9922,11 +10281,11 @@ _mesa_create_save_table(void)
SET_ClampColor(table, save_ClampColorARB);
/* GL 3.0 */
-#if 0
SET_ClearBufferiv(table, save_ClearBufferiv);
SET_ClearBufferuiv(table, save_ClearBufferuiv);
SET_ClearBufferfv(table, save_ClearBufferfv);
SET_ClearBufferfi(table, save_ClearBufferfi);
+#if 0
SET_Uniform1ui(table, save_Uniform1ui);
SET_Uniform2ui(table, save_Uniform2ui);
SET_Uniform3ui(table, save_Uniform3ui);
@@ -9936,10 +10295,6 @@ _mesa_create_save_table(void)
SET_Uniform3uiv(table, save_Uniform3uiv);
SET_Uniform4uiv(table, save_Uniform4uiv);
#else
- (void) save_ClearBufferiv;
- (void) save_ClearBufferuiv;
- (void) save_ClearBufferfv;
- (void) save_ClearBufferfi;
(void) save_Uniform1ui;
(void) save_Uniform2ui;
(void) save_Uniform3ui;
@@ -9950,6 +10305,16 @@ _mesa_create_save_table(void)
(void) save_Uniform4uiv;
#endif
+#if FEATURE_EXT_transform_feedback
+ SET_BeginTransformFeedbackEXT(table, save_BeginTransformFeedback);
+ SET_EndTransformFeedbackEXT(table, save_EndTransformFeedback);
+ SET_TransformFeedbackVaryingsEXT(table, save_TransformFeedbackVaryings);
+ SET_BindTransformFeedback(table, save_BindTransformFeedback);
+ SET_PauseTransformFeedback(table, save_PauseTransformFeedback);
+ SET_ResumeTransformFeedback(table, save_ResumeTransformFeedback);
+ SET_DrawTransformFeedback(table, save_DrawTransformFeedback);
+#endif
+
/* GL_ARB_instanced_arrays */
SET_VertexAttribDivisorARB(table, save_VertexAttribDivisor);
@@ -9957,7 +10322,14 @@ _mesa_create_save_table(void)
SET_TextureBarrierNV(table, save_TextureBarrierNV);
/* GL_ARB_sampler_objects */
+ _mesa_init_sampler_object_dispatch(table); /* plug in Gen/Get/etc functions */
SET_BindSampler(table, save_BindSampler);
+ SET_SamplerParameteri(table, save_SamplerParameteri);
+ SET_SamplerParameterf(table, save_SamplerParameterf);
+ SET_SamplerParameteriv(table, save_SamplerParameteriv);
+ SET_SamplerParameterfv(table, save_SamplerParameterfv);
+ SET_SamplerParameterIiv(table, save_SamplerParameterIiv);
+ SET_SamplerParameterIuiv(table, save_SamplerParameterIuiv);
/* GL_ARB_draw_buffer_blend */
SET_BlendFunciARB(table, save_BlendFunci);
@@ -9965,6 +10337,15 @@ _mesa_create_save_table(void)
SET_BlendEquationiARB(table, save_BlendEquationi);
SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei);
+ /* GL_ARB_geometry_shader4 */
+ SET_ProgramParameteriARB(table, save_ProgramParameteri);
+ SET_FramebufferTextureARB(table, save_FramebufferTexture);
+ SET_FramebufferTextureFaceARB(table, save_FramebufferTextureFace);
+
+ /* GL_ARB_sync */
+ _mesa_init_sync_dispatch(table);
+ SET_WaitSync(table, save_WaitSync);
+
return table;
}
diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c
index 5e54bbdf3..a112d83ea 100644
--- a/mesalib/src/mesa/main/fbobject.c
+++ b/mesalib/src/mesa/main/fbobject.c
@@ -795,7 +795,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
}
#if FEATURE_GL
- if (ctx->API == API_OPENGL) {
+ if (ctx->API == API_OPENGL && !ctx->Extensions.ARB_ES2_compatibility) {
/* Check that all DrawBuffers are present */
for (j = 0; j < ctx->Const.MaxDrawBuffers; j++) {
if (fb->ColorDrawBuffer[j] != GL_NONE) {
diff --git a/mesalib/src/mesa/main/queryobj.c b/mesalib/src/mesa/main/queryobj.c
index c3c1aa170..33be9232e 100644
--- a/mesalib/src/mesa/main/queryobj.c
+++ b/mesalib/src/mesa/main/queryobj.c
@@ -173,7 +173,7 @@ get_query_binding_point(struct gl_context *ctx, GLenum target)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_GenQueriesARB(GLsizei n, GLuint *ids)
{
GLuint first;
@@ -212,7 +212,7 @@ _mesa_GenQueriesARB(GLsizei n, GLuint *ids)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids)
{
GLint i;
@@ -248,7 +248,7 @@ _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids)
}
-GLboolean GLAPIENTRY
+static GLboolean GLAPIENTRY
_mesa_IsQueryARB(GLuint id)
{
GET_CURRENT_CONTEXT(ctx);
@@ -352,7 +352,7 @@ _mesa_EndQueryARB(GLenum target)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
{
struct gl_query_object *q, **bindpt;
@@ -386,7 +386,7 @@ _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
{
struct gl_query_object *q = NULL;
@@ -437,7 +437,7 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params)
}
-void GLAPIENTRY
+static void GLAPIENTRY
_mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params)
{
struct gl_query_object *q = NULL;
diff --git a/mesalib/src/mesa/main/queryobj.h b/mesalib/src/mesa/main/queryobj.h
index 4e8a1455b..16962e55a 100644
--- a/mesalib/src/mesa/main/queryobj.h
+++ b/mesalib/src/mesa/main/queryobj.h
@@ -1,96 +1,78 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.1
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-#ifndef QUERYOBJ_H
-#define QUERYOBJ_H
-
-
-#include "main/mfeatures.h"
-#include "main/mtypes.h"
-#include "main/hash.h"
-
-
-#if FEATURE_queryobj
-
-static INLINE struct gl_query_object *
-_mesa_lookup_query_object(struct gl_context *ctx, GLuint id)
-{
- return (struct gl_query_object *)
- _mesa_HashLookup(ctx->Query.QueryObjects, id);
-}
-
-
-extern void GLAPIENTRY
-_mesa_GenQueriesARB(GLsizei n, GLuint *ids);
-
-extern void GLAPIENTRY
-_mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids);
-
-extern GLboolean GLAPIENTRY
-_mesa_IsQueryARB(GLuint id);
-
-extern void GLAPIENTRY
-_mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params);
-
-extern void GLAPIENTRY
-_mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params);
-
-extern void
-_mesa_init_query_object_functions(struct dd_function_table *driver);
-
-extern void
-_mesa_init_queryobj_dispatch(struct _glapi_table *disp);
-
-#else /* FEATURE_queryobj */
-
-static INLINE struct gl_query_object *
-_mesa_lookup_query_object(struct gl_context *ctx, GLuint id)
-{
- return NULL;
-}
-
-static INLINE void
-_mesa_init_query_object_functions(struct dd_function_table *driver)
-{
-}
-
-static INLINE void
-_mesa_init_queryobj_dispatch(struct _glapi_table *disp)
-{
-}
-
-#endif /* FEATURE_queryobj */
-
-extern void
-_mesa_init_queryobj(struct gl_context *ctx);
-
-extern void
-_mesa_free_queryobj_data(struct gl_context *ctx);
-
-
-#endif /* QUERYOBJ_H */
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.1
+ *
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+#ifndef QUERYOBJ_H
+#define QUERYOBJ_H
+
+
+#include "main/mfeatures.h"
+#include "main/mtypes.h"
+#include "main/hash.h"
+
+
+#if FEATURE_queryobj
+
+static INLINE struct gl_query_object *
+_mesa_lookup_query_object(struct gl_context *ctx, GLuint id)
+{
+ return (struct gl_query_object *)
+ _mesa_HashLookup(ctx->Query.QueryObjects, id);
+}
+
+
+extern void
+_mesa_init_query_object_functions(struct dd_function_table *driver);
+
+extern void
+_mesa_init_queryobj_dispatch(struct _glapi_table *disp);
+
+#else /* FEATURE_queryobj */
+
+static INLINE struct gl_query_object *
+_mesa_lookup_query_object(struct gl_context *ctx, GLuint id)
+{
+ return NULL;
+}
+
+static INLINE void
+_mesa_init_query_object_functions(struct dd_function_table *driver)
+{
+}
+
+static INLINE void
+_mesa_init_queryobj_dispatch(struct _glapi_table *disp)
+{
+}
+
+#endif /* FEATURE_queryobj */
+
+extern void
+_mesa_init_queryobj(struct gl_context *ctx);
+
+extern void
+_mesa_free_queryobj_data(struct gl_context *ctx);
+
+
+#endif /* QUERYOBJ_H */
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c
index baebb5cd3..e6d1d5b7d 100644
--- a/mesalib/src/mesa/main/shaderapi.c
+++ b/mesalib/src/mesa/main/shaderapi.c
@@ -1519,7 +1519,8 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
for (i = 0; i < count; i++) {
if (string[i] == NULL) {
free((GLvoid *) offsets);
- _mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)");
+ _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glShaderSourceARB(null string)");
return;
}
if (length == NULL || length[i] < 0)
@@ -1570,7 +1571,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
free(source);
source = newSource;
}
- }
+ }
shader_source(ctx, shaderObj, source);
@@ -1709,8 +1710,7 @@ _mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum binaryformat,
#if FEATURE_ARB_geometry_shader4
void GLAPIENTRY
-_mesa_ProgramParameteriARB(GLuint program, GLenum pname,
- GLint value)
+_mesa_ProgramParameteriARB(GLuint program, GLenum pname, GLint value)
{
struct gl_shader_program *shProg;
GET_CURRENT_CONTEXT(ctx);
diff --git a/mesalib/src/mesa/main/texformat.c b/mesalib/src/mesa/main/texformat.c
index 41d9e9599..8cbb021d8 100644
--- a/mesalib/src/mesa/main/texformat.c
+++ b/mesalib/src/mesa/main/texformat.c
@@ -1,763 +1,765 @@
-/*
- * Mesa 3-D graphics library
- * Version: 7.7
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (c) 2008-2009 VMware, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/**
- * \file texformat.c
- * Texture formats.
- *
- * \author Gareth Hughes
- * \author Brian Paul
- */
-
-
-#include "context.h"
-#include "mfeatures.h"
-#include "mtypes.h"
-#include "texcompress.h"
-#include "texformat.h"
-
-#define RETURN_IF_SUPPORTED(f) do { \
- if (ctx->TextureFormatSupported[f]) \
- return f; \
-} while (0)
-
-/**
- * Choose an appropriate texture format given the format, type and
- * internalFormat parameters passed to glTexImage().
- *
- * \param ctx the GL context.
- * \param internalFormat user's prefered internal texture format.
- * \param format incoming image pixel format.
- * \param type incoming image data type.
- *
- * \return a pointer to a gl_texture_format object which describes the
- * choosen texture format, or NULL on failure.
- *
- * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
- * will typically override this function with a specialized version.
- */
-gl_format
-_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
- GLenum format, GLenum type )
-{
- (void) format;
- (void) type;
-
- switch (internalFormat) {
- /* shallow RGBA formats */
- case 4:
- case GL_RGBA:
- if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
- } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555);
- }
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
-
- case GL_RGBA8:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
- case GL_RGB5_A1:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555);
- break;
- case GL_RGBA2:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444_REV); /* just to test another format*/
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
- break;
- case GL_RGBA4:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
- break;
-
- /* deep RGBA formats */
- case GL_RGB10_A2:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
- case GL_RGBA12:
- case GL_RGBA16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
-
- /* shallow RGB formats */
- case 3:
- case GL_RGB:
- case GL_RGB8:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
- case GL_R3_G3_B2:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB332);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
- case GL_RGB4:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); /* just to test another format */
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565);
- break;
- case GL_RGB5:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565);
- break;
-
- /* deep RGB formats */
- case GL_RGB10:
- case GL_RGB12:
- case GL_RGB16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
-
- /* Alpha formats */
- case GL_ALPHA:
- case GL_ALPHA4:
- case GL_ALPHA8:
- RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
- break;
-
- case GL_ALPHA12:
- case GL_ALPHA16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_A16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
- break;
-
- /* Luminance formats */
- case 1:
- case GL_LUMINANCE:
- case GL_LUMINANCE4:
- case GL_LUMINANCE8:
- RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
- break;
-
- case GL_LUMINANCE12:
- case GL_LUMINANCE16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_L16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
- break;
-
- /* Luminance/Alpha formats */
- case GL_LUMINANCE4_ALPHA4:
- RETURN_IF_SUPPORTED(MESA_FORMAT_AL44);
- RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
- break;
-
- case 2:
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE6_ALPHA2:
- case GL_LUMINANCE8_ALPHA8:
- RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
- break;
-
- case GL_LUMINANCE12_ALPHA4:
- case GL_LUMINANCE12_ALPHA12:
- case GL_LUMINANCE16_ALPHA16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_AL1616);
- RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
- break;
-
- case GL_INTENSITY:
- case GL_INTENSITY4:
- case GL_INTENSITY8:
- RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
- break;
-
- case GL_INTENSITY12:
- case GL_INTENSITY16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_I16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
- break;
-
- case GL_COLOR_INDEX:
- case GL_COLOR_INDEX1_EXT:
- case GL_COLOR_INDEX2_EXT:
- case GL_COLOR_INDEX4_EXT:
- case GL_COLOR_INDEX12_EXT:
- case GL_COLOR_INDEX16_EXT:
- case GL_COLOR_INDEX8_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_CI8);
- break;
-
- default:
- ; /* fallthrough */
- }
-
- if (ctx->Extensions.ARB_depth_texture) {
- switch (internalFormat) {
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32:
- RETURN_IF_SUPPORTED(MESA_FORMAT_Z32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
- break;
- case GL_DEPTH_COMPONENT16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_Z16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
- default:
- ; /* fallthrough */
- }
- }
-
- switch (internalFormat) {
- case GL_COMPRESSED_ALPHA_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
- break;
- case GL_COMPRESSED_LUMINANCE_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
- break;
- case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
- break;
- case GL_COMPRESSED_INTENSITY_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
- break;
- case GL_COMPRESSED_RGB_ARB:
- if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
- case GL_COMPRESSED_RGBA_ARB:
- if (ctx->Extensions.EXT_texture_compression_s3tc ||
- ctx->Extensions.S3_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
- if (ctx->Extensions.TDFX_texture_compression_FXT1)
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
- default:
- ; /* fallthrough */
- }
-
- if (ctx->Extensions.MESA_ycbcr_texture) {
- if (internalFormat == GL_YCBCR_MESA) {
- if (type == GL_UNSIGNED_SHORT_8_8_MESA)
- RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR);
- else
- RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR_REV);
- }
- }
-
-#if FEATURE_texture_fxt1
- if (ctx->Extensions.TDFX_texture_compression_FXT1) {
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_FXT1_3DFX:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
- break;
- case GL_COMPRESSED_RGBA_FXT1_3DFX:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
- break;
- default:
- ; /* fallthrough */
- }
- }
-#endif
-
-#if FEATURE_texture_s3tc
- if (ctx->Extensions.EXT_texture_compression_s3tc) {
- switch (internalFormat) {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT1);
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3);
- break;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT5);
- break;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.S3_s3tc) {
- switch (internalFormat) {
- case GL_RGB_S3TC:
- case GL_RGB4_S3TC:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
- break;
- case GL_RGBA_S3TC:
- case GL_RGBA4_S3TC:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3);
- break;
- default:
- ; /* fallthrough */
- }
- }
-#endif
-
- if (ctx->Extensions.ARB_texture_float) {
- switch (internalFormat) {
- case GL_ALPHA16F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_ALPHA32F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_LUMINANCE16F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_LUMINANCE32F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_LUMINANCE_ALPHA16F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_LUMINANCE_ALPHA32F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_INTENSITY16F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_INTENSITY32F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_RGB16F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_RGB32F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_RGBA16F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_RGBA32F_ARB:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_texture_shared_exponent) {
- switch (internalFormat) {
- case GL_RGB9_E5:
- ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_RGB9_E5_FLOAT]);
- return MESA_FORMAT_RGB9_E5_FLOAT;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_packed_float) {
- switch (internalFormat) {
- case GL_R11F_G11F_B10F:
- ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R11_G11_B10_FLOAT]);
- return MESA_FORMAT_R11_G11_B10_FLOAT;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_packed_depth_stencil) {
- switch (internalFormat) {
- case GL_DEPTH_STENCIL_EXT:
- case GL_DEPTH24_STENCIL8_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_S8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
- break;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.ATI_envmap_bumpmap) {
- switch (internalFormat) {
- case GL_DUDV_ATI:
- case GL_DU8DV8_ATI:
- RETURN_IF_SUPPORTED(MESA_FORMAT_DUDV8);
- break;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_texture_snorm) {
- switch (internalFormat) {
- case GL_RED_SNORM:
- case GL_R8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R8);
- break;
- case GL_RG_SNORM:
- case GL_RG8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG88_REV);
- break;
- case GL_RGB_SNORM:
- case GL_RGB8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888);
- /* FALLTHROUGH */
- case GL_RGBA_SNORM:
- case GL_RGBA8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- case GL_ALPHA_SNORM:
- case GL_ALPHA8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- case GL_LUMINANCE_SNORM:
- case GL_LUMINANCE8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- case GL_LUMINANCE_ALPHA_SNORM:
- case GL_LUMINANCE8_ALPHA8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL88);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- case GL_INTENSITY_SNORM:
- case GL_INTENSITY8_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- case GL_R16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R16);
- break;
- case GL_RG16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_GR1616);
- break;
- case GL_RGB16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGB_16);
- /* FALLTHROUGH */
- case GL_RGBA16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- case GL_ALPHA16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- case GL_LUMINANCE16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L16);
- /* FALLTHROUGH */
- case GL_LUMINANCE16_ALPHA16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL1616);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- case GL_INTENSITY16_SNORM:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
- break;
- default:
- ; /* fall-through */
- }
- }
-
-#if FEATURE_EXT_texture_sRGB
- if (ctx->Extensions.EXT_texture_sRGB) {
- switch (internalFormat) {
- case GL_SRGB_EXT:
- case GL_SRGB8_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_SRGB_ALPHA_EXT:
- case GL_SRGB8_ALPHA8_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_SLUMINANCE_EXT:
- case GL_SLUMINANCE8_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SL8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_SLUMINANCE_ALPHA_EXT:
- case GL_SLUMINANCE8_ALPHA8_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_COMPRESSED_SLUMINANCE_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SL8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_COMPRESSED_SRGB_EXT:
-#if FEATURE_texture_s3tc
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
-#endif
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_COMPRESSED_SRGB_ALPHA_EXT:
-#if FEATURE_texture_s3tc
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
-#endif
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
-#if FEATURE_texture_s3tc
- case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT1);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
- case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
- if (ctx->Extensions.EXT_texture_compression_s3tc)
- RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT5);
- RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
- break;
-#endif
- default:
- ; /* fallthrough */
- }
- }
-#endif /* FEATURE_EXT_texture_sRGB */
-
- if (ctx->Extensions.EXT_texture_integer) {
- switch (internalFormat) {
- case GL_RGBA32UI_EXT:
- case GL_RGB32UI_EXT:
- case GL_ALPHA32UI_EXT:
- case GL_INTENSITY32UI_EXT:
- case GL_LUMINANCE32UI_EXT:
- case GL_LUMINANCE_ALPHA32UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
- break;
- case GL_RGBA16UI_EXT:
- case GL_RGB16UI_EXT:
- case GL_ALPHA16UI_EXT:
- case GL_INTENSITY16UI_EXT:
- case GL_LUMINANCE16UI_EXT:
- case GL_LUMINANCE_ALPHA16UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
- break;
- case GL_RGBA8UI_EXT:
- case GL_RGB8UI_EXT:
- case GL_ALPHA8UI_EXT:
- case GL_INTENSITY8UI_EXT:
- case GL_LUMINANCE8UI_EXT:
- case GL_LUMINANCE_ALPHA8UI_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
- break;
- case GL_RGBA32I_EXT:
- case GL_RGB32I_EXT:
- case GL_ALPHA32I_EXT:
- case GL_INTENSITY32I_EXT:
- case GL_LUMINANCE32I_EXT:
- case GL_LUMINANCE_ALPHA32I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
- break;
- case GL_RGBA16I_EXT:
- case GL_RGB16I_EXT:
- case GL_ALPHA16I_EXT:
- case GL_INTENSITY16I_EXT:
- case GL_LUMINANCE16I_EXT:
- case GL_LUMINANCE_ALPHA16I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
- break;
- case GL_RGBA8I_EXT:
- case GL_RGB8I_EXT:
- case GL_ALPHA8I_EXT:
- case GL_INTENSITY8I_EXT:
- case GL_LUMINANCE8I_EXT:
- case GL_LUMINANCE_ALPHA8I_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
- break;
- }
- }
-
- if (ctx->Extensions.ARB_texture_rg) {
- switch (internalFormat) {
- case GL_R8:
- case GL_RED:
- RETURN_IF_SUPPORTED(MESA_FORMAT_R8);
- break;
-
- case GL_COMPRESSED_RED:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1);
- RETURN_IF_SUPPORTED(MESA_FORMAT_R8);
- break;
-
- case GL_R16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_R16);
- break;
-
- case GL_RG:
- case GL_RG8:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RG88);
- break;
-
- case GL_COMPRESSED_RG:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RG88);
- break;
-
- case GL_RG16:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RG1616);
- break;
-
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.ARB_texture_rg && ctx->Extensions.ARB_texture_float) {
- switch (internalFormat) {
- case GL_R16F:
- RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_R32F:
- RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_RG16F:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
- case GL_RG32F:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
- RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
- break;
-
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_texture_format_BGRA8888) {
- switch (internalFormat) {
- case GL_BGRA:
- RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
- break;
-
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.ARB_texture_compression_rgtc) {
- switch (internalFormat) {
- case GL_COMPRESSED_RED_RGTC1:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1);
- break;
- case GL_COMPRESSED_SIGNED_RED_RGTC1:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RED_RGTC1);
- break;
- case GL_COMPRESSED_RG_RGTC2:
- RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2);
- break;
- case GL_COMPRESSED_SIGNED_RG_RGTC2:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG_RGTC2);
- break;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.EXT_texture_compression_latc) {
- switch (internalFormat) {
- case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_L_LATC1);
- break;
- case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L_LATC1);
- break;
- case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LA_LATC2);
- break;
- case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
- RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_LA_LATC2);
- break;
- default:
- ; /* fallthrough */
- }
- }
-
- if (ctx->Extensions.ATI_texture_compression_3dc) {
- switch (internalFormat) {
- case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
- RETURN_IF_SUPPORTED(MESA_FORMAT_LA_LATC2);
- break;
- default:
- ; /* fallthrough */
- }
- }
-
- _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
- return MESA_FORMAT_NONE;
-}
-
+/*
+ * Mesa 3-D graphics library
+ * Version: 7.7
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (c) 2008-2009 VMware, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/**
+ * \file texformat.c
+ * Texture formats.
+ *
+ * \author Gareth Hughes
+ * \author Brian Paul
+ */
+
+
+#include "context.h"
+#include "mfeatures.h"
+#include "mtypes.h"
+#include "texcompress.h"
+#include "texformat.h"
+
+#define RETURN_IF_SUPPORTED(f) do { \
+ if (ctx->TextureFormatSupported[f]) \
+ return f; \
+} while (0)
+
+/**
+ * Choose an appropriate texture format given the format, type and
+ * internalFormat parameters passed to glTexImage().
+ *
+ * \param ctx the GL context.
+ * \param internalFormat user's prefered internal texture format.
+ * \param format incoming image pixel format.
+ * \param type incoming image data type.
+ *
+ * \return a pointer to a gl_texture_format object which describes the
+ * choosen texture format, or NULL on failure.
+ *
+ * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers
+ * will typically override this function with a specialized version.
+ */
+gl_format
+_mesa_choose_tex_format( struct gl_context *ctx, GLint internalFormat,
+ GLenum format, GLenum type )
+{
+ (void) format;
+ (void) type;
+
+ switch (internalFormat) {
+ /* shallow RGBA formats */
+ case 4:
+ case GL_RGBA:
+ if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) {
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
+ } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555);
+ }
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+
+ case GL_RGBA8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+ case GL_RGB5_A1:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555);
+ break;
+ case GL_RGBA2:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444_REV); /* just to test another format*/
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
+ break;
+ case GL_RGBA4:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
+ break;
+
+ /* deep RGBA formats */
+ case GL_RGB10_A2:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+ case GL_RGBA12:
+ case GL_RGBA16:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+
+ /* shallow RGB formats */
+ case 3:
+ case GL_RGB:
+ case GL_RGB8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+ case GL_R3_G3_B2:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB332);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+ case GL_RGB4:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565_REV); /* just to test another format */
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565);
+ break;
+ case GL_RGB5:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB565);
+ break;
+
+ /* deep RGB formats */
+ case GL_RGB10:
+ case GL_RGB12:
+ case GL_RGB16:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+
+ /* Alpha formats */
+ case GL_ALPHA:
+ case GL_ALPHA4:
+ case GL_ALPHA8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
+ break;
+
+ case GL_ALPHA12:
+ case GL_ALPHA16:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
+ break;
+
+ /* Luminance formats */
+ case 1:
+ case GL_LUMINANCE:
+ case GL_LUMINANCE4:
+ case GL_LUMINANCE8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
+ break;
+
+ case GL_LUMINANCE12:
+ case GL_LUMINANCE16:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
+ break;
+
+ /* Luminance/Alpha formats */
+ case GL_LUMINANCE4_ALPHA4:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL44);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+ break;
+
+ case 2:
+ case GL_LUMINANCE_ALPHA:
+ case GL_LUMINANCE6_ALPHA2:
+ case GL_LUMINANCE8_ALPHA8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+ break;
+
+ case GL_LUMINANCE12_ALPHA4:
+ case GL_LUMINANCE12_ALPHA12:
+ case GL_LUMINANCE16_ALPHA16:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL1616);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+ break;
+
+ case GL_INTENSITY:
+ case GL_INTENSITY4:
+ case GL_INTENSITY8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
+ break;
+
+ case GL_INTENSITY12:
+ case GL_INTENSITY16:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_I16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
+ break;
+
+ case GL_COLOR_INDEX:
+ case GL_COLOR_INDEX1_EXT:
+ case GL_COLOR_INDEX2_EXT:
+ case GL_COLOR_INDEX4_EXT:
+ case GL_COLOR_INDEX12_EXT:
+ case GL_COLOR_INDEX16_EXT:
+ case GL_COLOR_INDEX8_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_CI8);
+ break;
+
+ default:
+ ; /* fallthrough */
+ }
+
+ if (ctx->Extensions.ARB_depth_texture) {
+ switch (internalFormat) {
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT24:
+ case GL_DEPTH_COMPONENT32:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_Z32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
+ break;
+ case GL_DEPTH_COMPONENT16:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_Z16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_X8_Z24);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ switch (internalFormat) {
+ case GL_COMPRESSED_ALPHA_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_A8);
+ break;
+ case GL_COMPRESSED_LUMINANCE_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L8);
+ break;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_AL88);
+ break;
+ case GL_COMPRESSED_INTENSITY_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_I8);
+ break;
+ case GL_COMPRESSED_RGB_ARB:
+ if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
+ if (ctx->Extensions.TDFX_texture_compression_FXT1)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+ case GL_COMPRESSED_RGBA_ARB:
+ if (ctx->Extensions.EXT_texture_compression_s3tc ||
+ ctx->Extensions.S3_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3); /* Not rgba_dxt1, see spec */
+ if (ctx->Extensions.TDFX_texture_compression_FXT1)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+
+ if (ctx->Extensions.MESA_ycbcr_texture) {
+ if (internalFormat == GL_YCBCR_MESA) {
+ if (type == GL_UNSIGNED_SHORT_8_8_MESA)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR);
+ else
+ RETURN_IF_SUPPORTED(MESA_FORMAT_YCBCR_REV);
+ }
+ }
+
+#if FEATURE_texture_fxt1
+ if (ctx->Extensions.TDFX_texture_compression_FXT1) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_FXT1_3DFX:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FXT1);
+ break;
+ case GL_COMPRESSED_RGBA_FXT1_3DFX:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FXT1);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+#endif
+
+#if FEATURE_texture_s3tc
+ if (ctx->Extensions.EXT_texture_compression_s3tc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT1);
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3);
+ break;
+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT5);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.S3_s3tc) {
+ switch (internalFormat) {
+ case GL_RGB_S3TC:
+ case GL_RGB4_S3TC:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_DXT1);
+ break;
+ case GL_RGBA_S3TC:
+ case GL_RGBA4_S3TC:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_DXT3);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+#endif
+
+ if (ctx->Extensions.ARB_texture_float) {
+ switch (internalFormat) {
+ case GL_ALPHA16F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_ALPHA32F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ALPHA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_LUMINANCE16F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_LUMINANCE32F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_LUMINANCE_ALPHA16F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_LUMINANCE_ALPHA32F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_INTENSITY16F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_INTENSITY32F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_INTENSITY_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_RGB16F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_RGB32F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGB_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_RGBA16F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_RGBA32F_ARB:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_texture_shared_exponent) {
+ switch (internalFormat) {
+ case GL_RGB9_E5:
+ ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_RGB9_E5_FLOAT]);
+ return MESA_FORMAT_RGB9_E5_FLOAT;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_packed_float) {
+ switch (internalFormat) {
+ case GL_R11F_G11F_B10F:
+ ASSERT(ctx->TextureFormatSupported[MESA_FORMAT_R11_G11_B10_FLOAT]);
+ return MESA_FORMAT_R11_G11_B10_FLOAT;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_packed_depth_stencil) {
+ switch (internalFormat) {
+ case GL_DEPTH_STENCIL_EXT:
+ case GL_DEPTH24_STENCIL8_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_Z24_S8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_S8_Z24);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ATI_envmap_bumpmap) {
+ switch (internalFormat) {
+ case GL_DUDV_ATI:
+ case GL_DU8DV8_ATI:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_DUDV8);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_texture_snorm) {
+ switch (internalFormat) {
+ case GL_RED_SNORM:
+ case GL_R8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R8);
+ break;
+ case GL_RG_SNORM:
+ case GL_RG8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG88_REV);
+ break;
+ case GL_RGB_SNORM:
+ case GL_RGB8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888);
+ /* FALLTHROUGH */
+ case GL_RGBA_SNORM:
+ case GL_RGBA8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
+ case GL_ALPHA_SNORM:
+ case GL_ALPHA8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
+ case GL_LUMINANCE_SNORM:
+ case GL_LUMINANCE8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBX8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
+ case GL_LUMINANCE_ALPHA_SNORM:
+ case GL_LUMINANCE8_ALPHA8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL88);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
+ case GL_INTENSITY_SNORM:
+ case GL_INTENSITY8_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
+ case GL_R16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_R16);
+ break;
+ case GL_RG16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_GR1616);
+ break;
+ case GL_RGB16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGB_16);
+ /* FALLTHROUGH */
+ case GL_RGBA16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
+ case GL_ALPHA16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_A16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
+ case GL_LUMINANCE16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L16);
+ /* FALLTHROUGH */
+ case GL_LUMINANCE16_ALPHA16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_AL1616);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
+ case GL_INTENSITY16_SNORM:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_I16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA_16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RGBA8888_REV);
+ break;
+ default:
+ ; /* fall-through */
+ }
+ }
+
+#if FEATURE_EXT_texture_sRGB
+ if (ctx->Extensions.EXT_texture_sRGB) {
+ switch (internalFormat) {
+ case GL_SRGB_EXT:
+ case GL_SRGB8_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_SRGB_ALPHA_EXT:
+ case GL_SRGB8_ALPHA8_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_SLUMINANCE_EXT:
+ case GL_SLUMINANCE8_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SL8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_SLUMINANCE_ALPHA_EXT:
+ case GL_SLUMINANCE8_ALPHA8_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_COMPRESSED_SLUMINANCE_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SL8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SLA8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_COMPRESSED_SRGB_EXT:
+#if FEATURE_texture_s3tc
+ if (ctx->Extensions.EXT_texture_compression_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
+#endif
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_COMPRESSED_SRGB_ALPHA_EXT:
+#if FEATURE_texture_s3tc
+ if (ctx->Extensions.EXT_texture_compression_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3); /* Not srgba_dxt1, see spec */
+#endif
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA8);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+#if FEATURE_texture_s3tc
+ case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
+ if (ctx->Extensions.EXT_texture_compression_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGB_DXT1);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
+ if (ctx->Extensions.EXT_texture_compression_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT1);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
+ if (ctx->Extensions.EXT_texture_compression_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT3);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+ case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
+ if (ctx->Extensions.EXT_texture_compression_s3tc)
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SRGBA_DXT5);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SARGB8);
+ break;
+#endif
+ default:
+ ; /* fallthrough */
+ }
+ }
+#endif /* FEATURE_EXT_texture_sRGB */
+
+ if (ctx->Extensions.EXT_texture_integer) {
+ switch (internalFormat) {
+ case GL_RGBA32UI_EXT:
+ case GL_RGB32UI_EXT:
+ case GL_ALPHA32UI_EXT:
+ case GL_INTENSITY32UI_EXT:
+ case GL_LUMINANCE32UI_EXT:
+ case GL_LUMINANCE_ALPHA32UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT32);
+ break;
+ case GL_RGBA16UI_EXT:
+ case GL_RGB16UI_EXT:
+ case GL_ALPHA16UI_EXT:
+ case GL_INTENSITY16UI_EXT:
+ case GL_LUMINANCE16UI_EXT:
+ case GL_LUMINANCE_ALPHA16UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT16);
+ break;
+ case GL_RGBA8UI_EXT:
+ case GL_RGB8UI_EXT:
+ case GL_ALPHA8UI_EXT:
+ case GL_INTENSITY8UI_EXT:
+ case GL_LUMINANCE8UI_EXT:
+ case GL_LUMINANCE_ALPHA8UI_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_UINT8);
+ break;
+ case GL_RGBA32I_EXT:
+ case GL_RGB32I_EXT:
+ case GL_ALPHA32I_EXT:
+ case GL_INTENSITY32I_EXT:
+ case GL_LUMINANCE32I_EXT:
+ case GL_LUMINANCE_ALPHA32I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT32);
+ break;
+ case GL_RGBA16I_EXT:
+ case GL_RGB16I_EXT:
+ case GL_ALPHA16I_EXT:
+ case GL_INTENSITY16I_EXT:
+ case GL_LUMINANCE16I_EXT:
+ case GL_LUMINANCE_ALPHA16I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT16);
+ break;
+ case GL_RGBA8I_EXT:
+ case GL_RGB8I_EXT:
+ case GL_ALPHA8I_EXT:
+ case GL_INTENSITY8I_EXT:
+ case GL_LUMINANCE8I_EXT:
+ case GL_LUMINANCE_ALPHA8I_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_INT8);
+ break;
+ }
+ }
+
+ if (ctx->Extensions.ARB_texture_rg) {
+ switch (internalFormat) {
+ case GL_R8:
+ case GL_RED:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8);
+ break;
+
+ case GL_COMPRESSED_RED:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R8);
+ break;
+
+ case GL_R16:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R16);
+ break;
+
+ case GL_RG:
+ case GL_RG8:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG88);
+ break;
+
+ case GL_COMPRESSED_RG:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG88);
+ break;
+
+ case GL_RG16:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG1616);
+ break;
+
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ARB_texture_rg && ctx->Extensions.ARB_texture_float) {
+ switch (internalFormat) {
+ case GL_R16F:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_R32F:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_R_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_RG16F:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT16);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+ case GL_RG32F:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_FLOAT32);
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA_FLOAT32);
+ break;
+
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_texture_format_BGRA8888) {
+ switch (internalFormat) {
+ case GL_BGRA:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
+ break;
+
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ARB_texture_compression_rgtc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_RED_RGTC1:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RED_RGTC1);
+ break;
+ case GL_COMPRESSED_SIGNED_RED_RGTC1:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RED_RGTC1);
+ break;
+ case GL_COMPRESSED_RG_RGTC2:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_RG_RGTC2);
+ break;
+ case GL_COMPRESSED_SIGNED_RG_RGTC2:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_RG_RGTC2);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.EXT_texture_compression_latc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_LUMINANCE_LATC1_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_L_LATC1);
+ break;
+ case GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_L_LATC1);
+ break;
+ case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LA_LATC2);
+ break;
+ case GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_SIGNED_LA_LATC2);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ if (ctx->Extensions.ATI_texture_compression_3dc) {
+ switch (internalFormat) {
+ case GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI:
+ RETURN_IF_SUPPORTED(MESA_FORMAT_LA_LATC2);
+ break;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
+ _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()");
+ return MESA_FORMAT_NONE;
+}
+
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 3656079b6..cf8a1d486 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -2693,7 +2693,7 @@ texsubimage(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
format, type, texImage)) {
/* error was recorded */
}
- else if (width > 0 && height > 0 && height > 0) {
+ else if (width > 0 && height > 0 && depth > 0) {
/* If we have a border, offset=-1 is legal. Bias by border width. */
switch (dims) {
case 3:
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index ebeaa9ce3..9bd7840e5 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -3172,7 +3172,8 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader)
&ctx->Extensions, ctx->API);
if (ctx->Shader.Flags & GLSL_DUMP) {
- printf("GLSL source for shader %d:\n", shader->Name);
+ printf("GLSL source for %s shader %d:\n",
+ _mesa_glsl_shader_target_name(state->target), shader->Name);
printf("%s\n", shader->Source);
}
diff --git a/mesalib/src/mesa/program/prog_parameter_layout.c b/mesalib/src/mesa/program/prog_parameter_layout.c
index d7dc97edb..90a977108 100644
--- a/mesalib/src/mesa/program/prog_parameter_layout.c
+++ b/mesalib/src/mesa/program/prog_parameter_layout.c
@@ -207,6 +207,7 @@ _mesa_layout_parameters(struct asm_parser_state *state)
}
}
+ layout->StateFlags = state->prog->Parameters->StateFlags;
_mesa_free_parameter_list(state->prog->Parameters);
state->prog->Parameters = layout;
diff --git a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
index 9b44d1a71..fcffc8734 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c
@@ -121,7 +121,7 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt)
uint *dest;
uint i, j;
- transfer = pipe_get_transfer(st_context(ctx)->pipe,
+ transfer = pipe_get_transfer(pipe,
pt, 0, 0, PIPE_TRANSFER_WRITE,
0, 0, texSize, texSize);
dest = (uint *) pipe_transfer_map(pipe, transfer);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_accum.c b/mesalib/src/mesa/state_tracker/st_cb_accum.c
index 66e5312d9..3e3659d15 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_accum.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_accum.c
@@ -1,347 +1,347 @@
-/**************************************************************************
- *
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
- /*
- * Authors:
- * Brian Paul
- */
-
-#include "main/imports.h"
-#include "main/image.h"
-#include "main/macros.h"
-#include "main/mfeatures.h"
-
-#include "st_debug.h"
-#include "st_context.h"
-#include "st_cb_accum.h"
-#include "st_cb_fbo.h"
-#include "st_texture.h"
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "util/u_format.h"
-#include "util/u_inlines.h"
-#include "util/u_tile.h"
-
-
-#if FEATURE_accum
-
-/**
- * For hardware that supports deep color buffers, we could accelerate
- * most/all the accum operations with blending/texturing.
- * For now, just use the get/put_tile() functions and do things in software.
- */
-
-
-void
-st_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
-{
- struct st_renderbuffer *acc_strb = st_renderbuffer(rb);
- const GLint xpos = ctx->DrawBuffer->_Xmin;
- const GLint ypos = ctx->DrawBuffer->_Ymin;
- const GLint width = ctx->DrawBuffer->_Xmax - xpos;
- const GLint height = ctx->DrawBuffer->_Ymax - ypos;
- size_t stride = acc_strb->stride;
- GLubyte *data = acc_strb->data;
-
- if(!data)
- return;
-
- switch (acc_strb->format) {
- case PIPE_FORMAT_R16G16B16A16_SNORM:
- {
- GLshort r = FLOAT_TO_SHORT(ctx->Accum.ClearColor[0]);
- GLshort g = FLOAT_TO_SHORT(ctx->Accum.ClearColor[1]);
- GLshort b = FLOAT_TO_SHORT(ctx->Accum.ClearColor[2]);
- GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]);
- int i, j;
- for (i = 0; i < height; i++) {
- GLshort *dst = (GLshort *) (data + (ypos + i) * stride + xpos * 8);
- for (j = 0; j < width; j++) {
- dst[0] = r;
- dst[1] = g;
- dst[2] = b;
- dst[3] = a;
- dst += 4;
- }
- }
- }
- break;
- default:
- _mesa_problem(ctx, "unexpected format in st_clear_accum_buffer()");
- }
-}
-
-
-/** For ADD/MULT */
-static void
-accum_mad(struct gl_context *ctx, GLfloat scale, GLfloat bias,
- GLint xpos, GLint ypos, GLint width, GLint height,
- struct st_renderbuffer *acc_strb)
-{
- size_t stride = acc_strb->stride;
- GLubyte *data = acc_strb->data;
-
- switch (acc_strb->format) {
- case PIPE_FORMAT_R16G16B16A16_SNORM:
- {
- int i, j;
- for (i = 0; i < height; i++) {
- GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8);
- for (j = 0; j < width * 4; j++) {
- float val = SHORT_TO_FLOAT(*acc) * scale + bias;
- *acc++ = FLOAT_TO_SHORT(val);
- }
- }
- }
- break;
- default:
- _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
- }
-}
-
-
-static void
-accum_accum(struct st_context *st, GLfloat value,
- GLint xpos, GLint ypos, GLint width, GLint height,
- struct st_renderbuffer *acc_strb,
- struct st_renderbuffer *color_strb)
-{
- struct pipe_context *pipe = st->pipe;
- struct pipe_transfer *color_trans;
- size_t stride = acc_strb->stride;
- GLubyte *data = acc_strb->data;
- GLfloat *buf;
-
- if (ST_DEBUG & DEBUG_FALLBACK)
- debug_printf("%s: fallback processing\n", __FUNCTION__);
-
- color_trans = pipe_get_transfer(st->pipe,
- color_strb->texture,
- 0, 0,
- PIPE_TRANSFER_READ, xpos, ypos,
- width, height);
-
- buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
-
- pipe_get_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
- util_format_linear(color_strb->texture->format),
- buf);
-
- switch (acc_strb->format) {
- case PIPE_FORMAT_R16G16B16A16_SNORM:
- {
- const GLfloat *color = buf;
- int i, j;
- for (i = 0; i < height; i++) {
- GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8);
- for (j = 0; j < width * 4; j++) {
- float val = *color++ * value;
- *acc++ += FLOAT_TO_SHORT(val);
- }
- }
- }
- break;
- default:
- _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
- }
-
- free(buf);
- pipe->transfer_destroy(pipe, color_trans);
-}
-
-
-static void
-accum_load(struct st_context *st, GLfloat value,
- GLint xpos, GLint ypos, GLint width, GLint height,
- struct st_renderbuffer *acc_strb,
- struct st_renderbuffer *color_strb)
-{
- struct pipe_context *pipe = st->pipe;
- struct pipe_transfer *color_trans;
- size_t stride = acc_strb->stride;
- GLubyte *data = acc_strb->data;
- GLfloat *buf;
-
- if (ST_DEBUG & DEBUG_FALLBACK)
- debug_printf("%s: fallback processing\n", __FUNCTION__);
-
- color_trans = pipe_get_transfer(st->pipe, color_strb->texture,
- 0, 0,
- PIPE_TRANSFER_READ, xpos, ypos,
- width, height);
-
- buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
-
- pipe_get_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
- util_format_linear(color_strb->texture->format),
- buf);
-
- switch (acc_strb->format) {
- case PIPE_FORMAT_R16G16B16A16_SNORM:
- {
- const GLfloat *color = buf;
- int i, j;
- for (i = 0; i < height; i++) {
- GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8);
- for (j = 0; j < width * 4; j++) {
- float val = *color++ * value;
- *acc++ = FLOAT_TO_SHORT(val);
- }
- }
- }
- break;
- default:
- _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
- }
-
- free(buf);
- pipe->transfer_destroy(pipe, color_trans);
-}
-
-
-static void
-accum_return(struct gl_context *ctx, GLfloat value,
- GLint xpos, GLint ypos, GLint width, GLint height,
- struct st_renderbuffer *acc_strb,
- struct st_renderbuffer *color_strb)
-{
- struct pipe_context *pipe = st_context(ctx)->pipe;
- const GLubyte *colormask = ctx->Color.ColorMask[0];
- enum pipe_transfer_usage usage;
- struct pipe_transfer *color_trans;
- size_t stride = acc_strb->stride;
- const GLubyte *data = acc_strb->data;
- GLfloat *buf;
- enum pipe_format format = util_format_linear(color_strb->texture->format);
-
- if (ST_DEBUG & DEBUG_FALLBACK)
- debug_printf("%s: fallback processing\n", __FUNCTION__);
-
- buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
-
- if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3])
- usage = PIPE_TRANSFER_READ_WRITE;
- else
- usage = PIPE_TRANSFER_WRITE;
-
- color_trans = pipe_get_transfer(st_context(ctx)->pipe,
- color_strb->texture, 0, 0,
- usage,
- xpos, ypos,
- width, height);
-
- if (usage & PIPE_TRANSFER_READ)
- pipe_get_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
- format, buf);
-
- switch (acc_strb->format) {
- case PIPE_FORMAT_R16G16B16A16_SNORM:
- {
- GLfloat *color = buf;
- int i, j, ch;
- for (i = 0; i < height; i++) {
- const GLshort *acc = (const GLshort *) (data + (ypos + i) * stride + xpos * 8);
- for (j = 0; j < width; j++) {
- for (ch = 0; ch < 4; ch++) {
- if (colormask[ch]) {
- GLfloat val = SHORT_TO_FLOAT(*acc * value);
- *color = CLAMP(val, 0.0f, 1.0f);
- }
- else {
- /* No change */
- }
- ++acc;
- ++color;
- }
- }
- }
- }
- break;
- default:
- _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
- }
-
- pipe_put_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
- format, buf);
-
- free(buf);
- pipe->transfer_destroy(pipe, color_trans);
-}
-
-
-static void
-st_Accum(struct gl_context *ctx, GLenum op, GLfloat value)
-{
- struct st_context *st = st_context(ctx);
- struct st_renderbuffer *acc_strb
- = st_renderbuffer(ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer);
- struct st_renderbuffer *color_strb
- = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
-
- const GLint xpos = ctx->DrawBuffer->_Xmin;
- const GLint ypos = ctx->DrawBuffer->_Ymin;
- const GLint width = ctx->DrawBuffer->_Xmax - xpos;
- const GLint height = ctx->DrawBuffer->_Ymax - ypos;
-
- if(!acc_strb->data)
- return;
-
- switch (op) {
- case GL_ADD:
- if (value != 0.0F) {
- accum_mad(ctx, 1.0, value, xpos, ypos, width, height, acc_strb);
- }
- break;
- case GL_MULT:
- if (value != 1.0F) {
- accum_mad(ctx, value, 0.0, xpos, ypos, width, height, acc_strb);
- }
- break;
- case GL_ACCUM:
- if (value != 0.0F) {
- accum_accum(st, value, xpos, ypos, width, height, acc_strb, color_strb);
- }
- break;
- case GL_LOAD:
- accum_load(st, value, xpos, ypos, width, height, acc_strb, color_strb);
- break;
- case GL_RETURN:
- accum_return(ctx, value, xpos, ypos, width, height, acc_strb, color_strb);
- break;
- default:
- assert(0);
- }
-}
-
-
-
-void st_init_accum_functions(struct dd_function_table *functions)
-{
- functions->Accum = st_Accum;
-}
-
-#endif /* FEATURE_accum */
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+ /*
+ * Authors:
+ * Brian Paul
+ */
+
+#include "main/imports.h"
+#include "main/image.h"
+#include "main/macros.h"
+#include "main/mfeatures.h"
+
+#include "st_debug.h"
+#include "st_context.h"
+#include "st_cb_accum.h"
+#include "st_cb_fbo.h"
+#include "st_texture.h"
+#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+#include "util/u_format.h"
+#include "util/u_inlines.h"
+#include "util/u_tile.h"
+
+
+#if FEATURE_accum
+
+/**
+ * For hardware that supports deep color buffers, we could accelerate
+ * most/all the accum operations with blending/texturing.
+ * For now, just use the get/put_tile() functions and do things in software.
+ */
+
+
+void
+st_clear_accum_buffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
+{
+ struct st_renderbuffer *acc_strb = st_renderbuffer(rb);
+ const GLint xpos = ctx->DrawBuffer->_Xmin;
+ const GLint ypos = ctx->DrawBuffer->_Ymin;
+ const GLint width = ctx->DrawBuffer->_Xmax - xpos;
+ const GLint height = ctx->DrawBuffer->_Ymax - ypos;
+ size_t stride = acc_strb->stride;
+ GLubyte *data = acc_strb->data;
+
+ if(!data)
+ return;
+
+ switch (acc_strb->format) {
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
+ {
+ GLshort r = FLOAT_TO_SHORT(ctx->Accum.ClearColor[0]);
+ GLshort g = FLOAT_TO_SHORT(ctx->Accum.ClearColor[1]);
+ GLshort b = FLOAT_TO_SHORT(ctx->Accum.ClearColor[2]);
+ GLshort a = FLOAT_TO_SHORT(ctx->Accum.ClearColor[3]);
+ int i, j;
+ for (i = 0; i < height; i++) {
+ GLshort *dst = (GLshort *) (data + (ypos + i) * stride + xpos * 8);
+ for (j = 0; j < width; j++) {
+ dst[0] = r;
+ dst[1] = g;
+ dst[2] = b;
+ dst[3] = a;
+ dst += 4;
+ }
+ }
+ }
+ break;
+ default:
+ _mesa_problem(ctx, "unexpected format in st_clear_accum_buffer()");
+ }
+}
+
+
+/** For ADD/MULT */
+static void
+accum_mad(struct gl_context *ctx, GLfloat scale, GLfloat bias,
+ GLint xpos, GLint ypos, GLint width, GLint height,
+ struct st_renderbuffer *acc_strb)
+{
+ size_t stride = acc_strb->stride;
+ GLubyte *data = acc_strb->data;
+
+ switch (acc_strb->format) {
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
+ {
+ int i, j;
+ for (i = 0; i < height; i++) {
+ GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8);
+ for (j = 0; j < width * 4; j++) {
+ float val = SHORT_TO_FLOAT(*acc) * scale + bias;
+ *acc++ = FLOAT_TO_SHORT(val);
+ }
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
+ }
+}
+
+
+static void
+accum_accum(struct st_context *st, GLfloat value,
+ GLint xpos, GLint ypos, GLint width, GLint height,
+ struct st_renderbuffer *acc_strb,
+ struct st_renderbuffer *color_strb)
+{
+ struct pipe_context *pipe = st->pipe;
+ struct pipe_transfer *color_trans;
+ size_t stride = acc_strb->stride;
+ GLubyte *data = acc_strb->data;
+ GLfloat *buf;
+
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
+
+ color_trans = pipe_get_transfer(st->pipe,
+ color_strb->texture,
+ 0, 0,
+ PIPE_TRANSFER_READ, xpos, ypos,
+ width, height);
+
+ buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+
+ pipe_get_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
+ util_format_linear(color_strb->texture->format),
+ buf);
+
+ switch (acc_strb->format) {
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
+ {
+ const GLfloat *color = buf;
+ int i, j;
+ for (i = 0; i < height; i++) {
+ GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8);
+ for (j = 0; j < width * 4; j++) {
+ float val = *color++ * value;
+ *acc++ += FLOAT_TO_SHORT(val);
+ }
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
+ }
+
+ free(buf);
+ pipe->transfer_destroy(pipe, color_trans);
+}
+
+
+static void
+accum_load(struct st_context *st, GLfloat value,
+ GLint xpos, GLint ypos, GLint width, GLint height,
+ struct st_renderbuffer *acc_strb,
+ struct st_renderbuffer *color_strb)
+{
+ struct pipe_context *pipe = st->pipe;
+ struct pipe_transfer *color_trans;
+ size_t stride = acc_strb->stride;
+ GLubyte *data = acc_strb->data;
+ GLfloat *buf;
+
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
+
+ color_trans = pipe_get_transfer(st->pipe, color_strb->texture,
+ 0, 0,
+ PIPE_TRANSFER_READ, xpos, ypos,
+ width, height);
+
+ buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+
+ pipe_get_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
+ util_format_linear(color_strb->texture->format),
+ buf);
+
+ switch (acc_strb->format) {
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
+ {
+ const GLfloat *color = buf;
+ int i, j;
+ for (i = 0; i < height; i++) {
+ GLshort *acc = (GLshort *) (data + (ypos + i) * stride + xpos * 8);
+ for (j = 0; j < width * 4; j++) {
+ float val = *color++ * value;
+ *acc++ = FLOAT_TO_SHORT(val);
+ }
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
+ }
+
+ free(buf);
+ pipe->transfer_destroy(pipe, color_trans);
+}
+
+
+static void
+accum_return(struct gl_context *ctx, GLfloat value,
+ GLint xpos, GLint ypos, GLint width, GLint height,
+ struct st_renderbuffer *acc_strb,
+ struct st_renderbuffer *color_strb)
+{
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+ const GLubyte *colormask = ctx->Color.ColorMask[0];
+ enum pipe_transfer_usage usage;
+ struct pipe_transfer *color_trans;
+ size_t stride = acc_strb->stride;
+ const GLubyte *data = acc_strb->data;
+ GLfloat *buf;
+ enum pipe_format format = util_format_linear(color_strb->texture->format);
+
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
+
+ buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+
+ if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3])
+ usage = PIPE_TRANSFER_READ_WRITE;
+ else
+ usage = PIPE_TRANSFER_WRITE;
+
+ color_trans = pipe_get_transfer(pipe,
+ color_strb->texture, 0, 0,
+ usage,
+ xpos, ypos,
+ width, height);
+
+ if (usage & PIPE_TRANSFER_READ)
+ pipe_get_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
+ format, buf);
+
+ switch (acc_strb->format) {
+ case PIPE_FORMAT_R16G16B16A16_SNORM:
+ {
+ GLfloat *color = buf;
+ int i, j, ch;
+ for (i = 0; i < height; i++) {
+ const GLshort *acc = (const GLshort *) (data + (ypos + i) * stride + xpos * 8);
+ for (j = 0; j < width; j++) {
+ for (ch = 0; ch < 4; ch++) {
+ if (colormask[ch]) {
+ GLfloat val = SHORT_TO_FLOAT(*acc * value);
+ *color = CLAMP(val, 0.0f, 1.0f);
+ }
+ else {
+ /* No change */
+ }
+ ++acc;
+ ++color;
+ }
+ }
+ }
+ }
+ break;
+ default:
+ _mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
+ }
+
+ pipe_put_tile_rgba_format(pipe, color_trans, 0, 0, width, height,
+ format, buf);
+
+ free(buf);
+ pipe->transfer_destroy(pipe, color_trans);
+}
+
+
+static void
+st_Accum(struct gl_context *ctx, GLenum op, GLfloat value)
+{
+ struct st_context *st = st_context(ctx);
+ struct st_renderbuffer *acc_strb
+ = st_renderbuffer(ctx->DrawBuffer->Attachment[BUFFER_ACCUM].Renderbuffer);
+ struct st_renderbuffer *color_strb
+ = st_renderbuffer(ctx->ReadBuffer->_ColorReadBuffer);
+
+ const GLint xpos = ctx->DrawBuffer->_Xmin;
+ const GLint ypos = ctx->DrawBuffer->_Ymin;
+ const GLint width = ctx->DrawBuffer->_Xmax - xpos;
+ const GLint height = ctx->DrawBuffer->_Ymax - ypos;
+
+ if(!acc_strb->data)
+ return;
+
+ switch (op) {
+ case GL_ADD:
+ if (value != 0.0F) {
+ accum_mad(ctx, 1.0, value, xpos, ypos, width, height, acc_strb);
+ }
+ break;
+ case GL_MULT:
+ if (value != 1.0F) {
+ accum_mad(ctx, value, 0.0, xpos, ypos, width, height, acc_strb);
+ }
+ break;
+ case GL_ACCUM:
+ if (value != 0.0F) {
+ accum_accum(st, value, xpos, ypos, width, height, acc_strb, color_strb);
+ }
+ break;
+ case GL_LOAD:
+ accum_load(st, value, xpos, ypos, width, height, acc_strb, color_strb);
+ break;
+ case GL_RETURN:
+ accum_return(ctx, value, xpos, ypos, width, height, acc_strb, color_strb);
+ break;
+ default:
+ assert(0);
+ }
+}
+
+
+
+void st_init_accum_functions(struct dd_function_table *functions)
+{
+ functions->Accum = st_Accum;
+}
+
+#endif /* FEATURE_accum */
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
index 06573d9ad..331defb52 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -222,8 +222,7 @@ st_bufferobj_data(struct gl_context *ctx,
}
if (data)
- pipe_buffer_write(st_context(ctx)->pipe, st_obj->buffer, 0,
- size, data);
+ pipe_buffer_write(pipe, st_obj->buffer, 0, size, data);
return GL_TRUE;
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index a197bf3ca..468355ccb 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -793,9 +793,10 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
else
usage = PIPE_TRANSFER_WRITE;
- pt = pipe_get_transfer(st_context(ctx)->pipe, strb->texture, 0, 0,
- usage, x, y,
- width, height);
+ pt = pipe_get_transfer(pipe, strb->texture,
+ strb->rtt_level, strb->rtt_face + strb->rtt_slice,
+ usage, x, y,
+ width, height);
stmap = pipe_transfer_map(pipe, pt);
@@ -1130,8 +1131,10 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
dsty = rbDraw->Base.Height - dsty - height;
}
- ptDraw = pipe_get_transfer(st_context(ctx)->pipe,
- rbDraw->texture, 0, 0,
+ ptDraw = pipe_get_transfer(pipe,
+ rbDraw->texture,
+ rbDraw->rtt_level,
+ rbDraw->rtt_face + rbDraw->rtt_slice,
usage, dstx, dsty,
width, height);
@@ -1291,8 +1294,10 @@ blit_copy_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
u_box_2d(readX, readY, readW, readH, &srcBox);
pipe->resource_copy_region(pipe,
- rbDraw->texture, 0, drawX, drawY, 0,
- rbRead->texture, 0, &srcBox);
+ rbDraw->texture,
+ rbDraw->rtt_level, drawX, drawY, 0,
+ rbRead->texture,
+ rbRead->rtt_level, &srcBox);
return GL_TRUE;
}
}
@@ -1444,10 +1449,10 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* copy source framebuffer surface into mipmap/texture */
pipe->resource_copy_region(pipe,
pt, /* dest tex */
- 0,
+ 0, /* dest lvl */
pack.SkipPixels, pack.SkipRows, 0, /* dest pos */
rbRead->texture, /* src tex */
- 0,
+ rbRead->rtt_level, /* src lvl */
&src_box);
}
@@ -1455,7 +1460,8 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* CPU-based fallback/conversion */
struct pipe_transfer *ptRead =
pipe_get_transfer(st->pipe, rbRead->texture,
- 0, 0, /* level, layer */
+ rbRead->rtt_level,
+ rbRead->rtt_face + rbRead->rtt_slice,
PIPE_TRANSFER_READ,
readX, readY, readW, readH);
struct pipe_transfer *ptTex;
diff --git a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
index 2c2da42c4..d85ef5d47 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_readpixels.c
@@ -82,7 +82,8 @@ st_read_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
/* Create a read transfer from the renderbuffer's texture */
pt = pipe_get_transfer(pipe, strb->texture,
- 0, 0,
+ strb->rtt_level,
+ strb->rtt_face + strb->rtt_slice,
PIPE_TRANSFER_READ,
x, y, width, height);
@@ -250,7 +251,8 @@ st_fast_readpixels(struct gl_context *ctx, struct st_renderbuffer *strb,
}
trans = pipe_get_transfer(pipe, strb->texture,
- 0, 0,
+ strb->rtt_level,
+ strb->rtt_face + strb->rtt_slice,
PIPE_TRANSFER_READ,
x, y, width, height);
if (!trans) {
@@ -445,7 +447,8 @@ st_readpixels(struct gl_context *ctx, GLint x, GLint y, GLsizei width, GLsizei h
/* Create a read transfer from the renderbuffer's texture */
trans = pipe_get_transfer(pipe, strb->texture,
- 0, 0,
+ strb->rtt_level, /* level */
+ strb->rtt_face + strb->rtt_slice, /* layer */
PIPE_TRANSFER_READ,
x, y, width, height);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 74f9449b7..7ef23df45 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -807,7 +807,7 @@ decompress_with_blit(struct gl_context * ctx, GLenum target, GLint level,
PIPE_TEX_MIPFILTER_NEAREST);
/* map the dst_surface so we can read from it */
- tex_xfer = pipe_get_transfer(st_context(ctx)->pipe,
+ tex_xfer = pipe_get_transfer(pipe,
dst_texture, 0, 0,
PIPE_TRANSFER_READ,
0, 0, width, height);
@@ -1228,7 +1228,7 @@ fallback_copy_texsubimage(struct gl_context *ctx, GLenum target, GLint level,
srcY = strb->Base.Height - srcY - height;
}
- src_trans = pipe_get_transfer(st_context(ctx)->pipe,
+ src_trans = pipe_get_transfer(pipe,
strb->texture,
0, 0,
PIPE_TRANSFER_READ,
diff --git a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
index 2c37c1107..b34794f1b 100644
--- a/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/mesalib/src/mesa/state_tracker/st_gen_mipmap.c
@@ -1,451 +1,451 @@
-/**************************************************************************
- *
- * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- **************************************************************************/
-
-
-#include "main/imports.h"
-#include "main/mipmap.h"
-#include "main/teximage.h"
-
-#include "pipe/p_context.h"
-#include "pipe/p_defines.h"
-#include "util/u_inlines.h"
-#include "util/u_format.h"
-#include "util/u_gen_mipmap.h"
-
-#include "st_debug.h"
-#include "st_context.h"
-#include "st_texture.h"
-#include "st_gen_mipmap.h"
-#include "st_cb_texture.h"
-
-
-/**
- * one-time init for generate mipmap
- * XXX Note: there may be other times we need no-op/simple state like this.
- * In that case, some code refactoring would be good.
- */
-void
-st_init_generate_mipmap(struct st_context *st)
-{
- st->gen_mipmap = util_create_gen_mipmap(st->pipe, st->cso_context);
-}
-
-
-void
-st_destroy_generate_mipmap(struct st_context *st)
-{
- util_destroy_gen_mipmap(st->gen_mipmap);
- st->gen_mipmap = NULL;
-}
-
-
-/**
- * Generate mipmap levels using hardware rendering.
- * \return TRUE if successful, FALSE if not possible
- */
-static boolean
-st_render_mipmap(struct st_context *st,
- GLenum target,
- struct st_texture_object *stObj,
- uint baseLevel, uint lastLevel)
-{
- struct pipe_context *pipe = st->pipe;
- struct pipe_screen *screen = pipe->screen;
- struct pipe_sampler_view *psv = st_get_texture_sampler_view(stObj, pipe);
- const uint face = _mesa_tex_target_to_face(target);
-
- assert(psv->texture == stObj->pt);
-#if 0
- assert(target != GL_TEXTURE_3D); /* implemented but untested */
-#endif
-
- /* check if we can render in the texture's format */
- /* XXX should probably kill this and always use util_gen_mipmap
- since this implements a sw fallback as well */
- if (!screen->is_format_supported(screen, psv->format, psv->texture->target,
- 0, PIPE_BIND_RENDER_TARGET)) {
- return FALSE;
- }
-
- util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel,
- PIPE_TEX_FILTER_LINEAR);
-
- return TRUE;
-}
-
-
-/**
- * Helper function to decompress an image. The result is a 32-bpp RGBA
- * image with stride==width.
- */
-static void
-decompress_image(enum pipe_format format, int datatype,
- const uint8_t *src, void *dst,
- unsigned width, unsigned height, unsigned src_stride)
-{
- const struct util_format_description *desc = util_format_description(format);
- const uint bw = util_format_get_blockwidth(format);
- const uint bh = util_format_get_blockheight(format);
- uint dst_stride = 4 * MAX2(width, bw);
-
- if (datatype == GL_FLOAT) {
- desc->unpack_rgba_float((float *)dst, dst_stride * sizeof(GLfloat), src, src_stride, width, height);
- if (width < bw || height < bh) {
- float *dst_p = (float *)dst;
- /* We're decompressing an image smaller than the compression
- * block size. We don't want garbage pixel values in the region
- * outside (width x height) so replicate pixels from the (width
- * x height) region to fill out the (bw x bh) block size.
- */
- uint x, y;
- for (y = 0; y < bh; y++) {
- for (x = 0; x < bw; x++) {
- if (x >= width || y >= height) {
- uint p = (y * bw + x) * 4;
- dst_p[p + 0] = dst_p[0];
- dst_p[p + 1] = dst_p[1];
- dst_p[p + 2] = dst_p[2];
- dst_p[p + 3] = dst_p[3];
- }
- }
- }
- }
- } else {
- desc->unpack_rgba_8unorm((uint8_t *)dst, dst_stride, src, src_stride, width, height);
- if (width < bw || height < bh) {
- uint8_t *dst_p = (uint8_t *)dst;
- /* We're decompressing an image smaller than the compression
- * block size. We don't want garbage pixel values in the region
- * outside (width x height) so replicate pixels from the (width
- * x height) region to fill out the (bw x bh) block size.
- */
- uint x, y;
- for (y = 0; y < bh; y++) {
- for (x = 0; x < bw; x++) {
- if (x >= width || y >= height) {
- uint p = (y * bw + x) * 4;
- dst_p[p + 0] = dst_p[0];
- dst_p[p + 1] = dst_p[1];
- dst_p[p + 2] = dst_p[2];
- dst_p[p + 3] = dst_p[3];
- }
- }
- }
- }
- }
-}
-
-/**
- * Helper function to compress an image. The source is a 32-bpp RGBA image
- * with stride==width.
- */
-static void
-compress_image(enum pipe_format format, int datatype,
- const void *src, uint8_t *dst,
- unsigned width, unsigned height, unsigned dst_stride)
-{
- const struct util_format_description *desc = util_format_description(format);
- const uint src_stride = 4 * width;
-
- if (datatype == GL_FLOAT)
- desc->pack_rgba_float(dst, dst_stride, (GLfloat *)src, src_stride * sizeof(GLfloat), width, height);
- else
- desc->pack_rgba_8unorm(dst, dst_stride, (uint8_t *)src, src_stride, width, height);
-}
-
-
-/**
- * Software fallback for generate mipmap levels.
- */
-static void
-fallback_generate_mipmap(struct gl_context *ctx, GLenum target,
- struct gl_texture_object *texObj)
-{
- struct pipe_context *pipe = st_context(ctx)->pipe;
- struct pipe_resource *pt = st_get_texobj_resource(texObj);
- const uint baseLevel = texObj->BaseLevel;
- const uint lastLevel = pt->last_level;
- const uint face = _mesa_tex_target_to_face(target);
- uint dstLevel;
- GLenum datatype;
- GLuint comps;
- GLboolean compressed;
-
- if (ST_DEBUG & DEBUG_FALLBACK)
- debug_printf("%s: fallback processing\n", __FUNCTION__);
-
- assert(target != GL_TEXTURE_3D); /* not done yet */
-
- compressed =
- _mesa_is_format_compressed(texObj->Image[face][baseLevel]->TexFormat);
-
- if (compressed) {
- GLenum type =
- _mesa_get_format_datatype(texObj->Image[face][baseLevel]->TexFormat);
-
- datatype = type == GL_UNSIGNED_NORMALIZED ? GL_UNSIGNED_BYTE : GL_FLOAT;
- comps = 4;
- }
- else {
- _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat,
- &datatype, &comps);
- assert(comps > 0 && "bad texture format in fallback_generate_mipmap()");
- }
-
- for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
- const uint srcLevel = dstLevel - 1;
- const uint srcWidth = u_minify(pt->width0, srcLevel);
- const uint srcHeight = u_minify(pt->height0, srcLevel);
- const uint srcDepth = u_minify(pt->depth0, srcLevel);
- const uint dstWidth = u_minify(pt->width0, dstLevel);
- const uint dstHeight = u_minify(pt->height0, dstLevel);
- const uint dstDepth = u_minify(pt->depth0, dstLevel);
- struct pipe_transfer *srcTrans, *dstTrans;
- const ubyte *srcData;
- ubyte *dstData;
- int srcStride, dstStride;
-
- srcTrans = pipe_get_transfer(st_context(ctx)->pipe, pt, srcLevel,
- face,
- PIPE_TRANSFER_READ, 0, 0,
- srcWidth, srcHeight);
-
- dstTrans = pipe_get_transfer(st_context(ctx)->pipe, pt, dstLevel,
- face,
- PIPE_TRANSFER_WRITE, 0, 0,
- dstWidth, dstHeight);
-
- srcData = (ubyte *) pipe_transfer_map(pipe, srcTrans);
- dstData = (ubyte *) pipe_transfer_map(pipe, dstTrans);
-
- srcStride = srcTrans->stride / util_format_get_blocksize(srcTrans->resource->format);
- dstStride = dstTrans->stride / util_format_get_blocksize(dstTrans->resource->format);
-
- /* this cannot work correctly for 3d since it does
- not respect layerStride. */
- if (compressed) {
- const enum pipe_format format = pt->format;
- const uint bw = util_format_get_blockwidth(format);
- const uint bh = util_format_get_blockheight(format);
- const uint srcWidth2 = align(srcWidth, bw);
- const uint srcHeight2 = align(srcHeight, bh);
- const uint dstWidth2 = align(dstWidth, bw);
- const uint dstHeight2 = align(dstHeight, bh);
- uint8_t *srcTemp, *dstTemp;
-
- assert(comps == 4);
-
- srcTemp = malloc(srcWidth2 * srcHeight2 * comps * (datatype == GL_FLOAT ? 4 : 1));
- dstTemp = malloc(dstWidth2 * dstHeight2 * comps * (datatype == GL_FLOAT ? 4 : 1));
-
- /* decompress the src image: srcData -> srcTemp */
- decompress_image(format, datatype, srcData, srcTemp, srcWidth2, srcHeight2, srcTrans->stride);
-
- _mesa_generate_mipmap_level(target, datatype, comps,
- 0 /*border*/,
- srcWidth2, srcHeight2, srcDepth,
- srcTemp,
- srcWidth2, /* stride in texels */
- dstWidth2, dstHeight2, dstDepth,
- dstTemp,
- dstWidth2); /* stride in texels */
-
- /* compress the new image: dstTemp -> dstData */
- compress_image(format, datatype, dstTemp, dstData, dstWidth2, dstHeight2, dstTrans->stride);
-
- free(srcTemp);
- free(dstTemp);
- }
- else {
- _mesa_generate_mipmap_level(target, datatype, comps,
- 0 /*border*/,
- srcWidth, srcHeight, srcDepth,
- srcData,
- srcStride, /* stride in texels */
- dstWidth, dstHeight, dstDepth,
- dstData,
- dstStride); /* stride in texels */
- }
-
- pipe_transfer_unmap(pipe, srcTrans);
- pipe_transfer_unmap(pipe, dstTrans);
-
- pipe->transfer_destroy(pipe, srcTrans);
- pipe->transfer_destroy(pipe, dstTrans);
- }
-}
-
-
-/**
- * Compute the expected number of mipmap levels in the texture given
- * the width/height/depth of the base image and the GL_TEXTURE_BASE_LEVEL/
- * GL_TEXTURE_MAX_LEVEL settings. This will tell us how many mipmap
- * levels should be generated.
- */
-static GLuint
-compute_num_levels(struct gl_context *ctx,
- struct gl_texture_object *texObj,
- GLenum target)
-{
- if (target == GL_TEXTURE_RECTANGLE_ARB) {
- return 1;
- }
- else {
- const struct gl_texture_image *baseImage =
- _mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel);
- GLuint size, numLevels;
-
- size = MAX2(baseImage->Width2, baseImage->Height2);
- size = MAX2(size, baseImage->Depth2);
-
- numLevels = texObj->BaseLevel;
-
- while (size > 0) {
- numLevels++;
- size >>= 1;
- }
-
- numLevels = MIN2(numLevels, texObj->MaxLevel + 1);
-
- assert(numLevels >= 1);
-
- return numLevels;
- }
-}
-
-
-/**
- * Called via ctx->Driver.GenerateMipmap().
- */
-void
-st_generate_mipmap(struct gl_context *ctx, GLenum target,
- struct gl_texture_object *texObj)
-{
- struct st_context *st = st_context(ctx);
- struct st_texture_object *stObj = st_texture_object(texObj);
- struct pipe_resource *pt = st_get_texobj_resource(texObj);
- const uint baseLevel = texObj->BaseLevel;
- uint lastLevel;
- uint dstLevel;
-
- if (!pt)
- return;
-
- /* not sure if this ultimately actually should work,
- but we're not supporting multisampled textures yet. */
- assert(pt->nr_samples < 2);
-
- /* find expected last mipmap level to generate*/
- lastLevel = compute_num_levels(ctx, texObj, target) - 1;
-
- if (lastLevel == 0)
- return;
-
- /* The texture isn't in a "complete" state yet so set the expected
- * lastLevel here, since it won't get done in st_finalize_texture().
- */
- stObj->lastLevel = lastLevel;
-
- if (pt->last_level < lastLevel) {
- /* The current gallium texture doesn't have space for all the
- * mipmap levels we need to generate. So allocate a new texture.
- */
- struct pipe_resource *oldTex = stObj->pt;
-
- /* create new texture with space for more levels */
- stObj->pt = st_texture_create(st,
- oldTex->target,
- oldTex->format,
- lastLevel,
- oldTex->width0,
- oldTex->height0,
- oldTex->depth0,
- oldTex->array_size,
- oldTex->bind);
-
- /* This will copy the old texture's base image into the new texture
- * which we just allocated.
- */
- st_finalize_texture(ctx, st->pipe, texObj);
-
- /* release the old tex (will likely be freed too) */
- pipe_resource_reference(&oldTex, NULL);
- pipe_sampler_view_reference(&stObj->sampler_view, NULL);
- }
- else {
- /* Make sure that the base texture image data is present in the
- * texture buffer.
- */
- st_finalize_texture(ctx, st->pipe, texObj);
- }
-
- pt = stObj->pt;
-
- assert(pt->last_level >= lastLevel);
-
- /* Try to generate the mipmap by rendering/texturing. If that fails,
- * use the software fallback.
- */
- if (!st_render_mipmap(st, target, stObj, baseLevel, lastLevel)) {
- /* since the util code actually also has a fallback, should
- probably make it never fail and kill this */
- fallback_generate_mipmap(ctx, target, texObj);
- }
-
- /* Fill in the Mesa gl_texture_image fields */
- for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
- const uint srcLevel = dstLevel - 1;
- const struct gl_texture_image *srcImage
- = _mesa_get_tex_image(ctx, texObj, target, srcLevel);
- struct gl_texture_image *dstImage;
- struct st_texture_image *stImage;
- uint dstWidth = u_minify(pt->width0, dstLevel);
- uint dstHeight = u_minify(pt->height0, dstLevel);
- uint dstDepth = u_minify(pt->depth0, dstLevel);
- uint border = srcImage->Border;
-
- dstImage = _mesa_get_tex_image(ctx, texObj, target, dstLevel);
- if (!dstImage) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
- return;
- }
-
- /* Free old image data */
- if (dstImage->Data)
- ctx->Driver.FreeTexImageData(ctx, dstImage);
-
- /* initialize new image */
- _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight,
- dstDepth, border, srcImage->InternalFormat,
- srcImage->TexFormat);
-
- stImage = st_texture_image(dstImage);
- stImage->level = dstLevel;
-
- pipe_resource_reference(&stImage->pt, pt);
- }
-}
+/**************************************************************************
+ *
+ * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include "main/imports.h"
+#include "main/mipmap.h"
+#include "main/teximage.h"
+
+#include "pipe/p_context.h"
+#include "pipe/p_defines.h"
+#include "util/u_inlines.h"
+#include "util/u_format.h"
+#include "util/u_gen_mipmap.h"
+
+#include "st_debug.h"
+#include "st_context.h"
+#include "st_texture.h"
+#include "st_gen_mipmap.h"
+#include "st_cb_texture.h"
+
+
+/**
+ * one-time init for generate mipmap
+ * XXX Note: there may be other times we need no-op/simple state like this.
+ * In that case, some code refactoring would be good.
+ */
+void
+st_init_generate_mipmap(struct st_context *st)
+{
+ st->gen_mipmap = util_create_gen_mipmap(st->pipe, st->cso_context);
+}
+
+
+void
+st_destroy_generate_mipmap(struct st_context *st)
+{
+ util_destroy_gen_mipmap(st->gen_mipmap);
+ st->gen_mipmap = NULL;
+}
+
+
+/**
+ * Generate mipmap levels using hardware rendering.
+ * \return TRUE if successful, FALSE if not possible
+ */
+static boolean
+st_render_mipmap(struct st_context *st,
+ GLenum target,
+ struct st_texture_object *stObj,
+ uint baseLevel, uint lastLevel)
+{
+ struct pipe_context *pipe = st->pipe;
+ struct pipe_screen *screen = pipe->screen;
+ struct pipe_sampler_view *psv = st_get_texture_sampler_view(stObj, pipe);
+ const uint face = _mesa_tex_target_to_face(target);
+
+ assert(psv->texture == stObj->pt);
+#if 0
+ assert(target != GL_TEXTURE_3D); /* implemented but untested */
+#endif
+
+ /* check if we can render in the texture's format */
+ /* XXX should probably kill this and always use util_gen_mipmap
+ since this implements a sw fallback as well */
+ if (!screen->is_format_supported(screen, psv->format, psv->texture->target,
+ 0, PIPE_BIND_RENDER_TARGET)) {
+ return FALSE;
+ }
+
+ util_gen_mipmap(st->gen_mipmap, psv, face, baseLevel, lastLevel,
+ PIPE_TEX_FILTER_LINEAR);
+
+ return TRUE;
+}
+
+
+/**
+ * Helper function to decompress an image. The result is a 32-bpp RGBA
+ * image with stride==width.
+ */
+static void
+decompress_image(enum pipe_format format, int datatype,
+ const uint8_t *src, void *dst,
+ unsigned width, unsigned height, unsigned src_stride)
+{
+ const struct util_format_description *desc = util_format_description(format);
+ const uint bw = util_format_get_blockwidth(format);
+ const uint bh = util_format_get_blockheight(format);
+ uint dst_stride = 4 * MAX2(width, bw);
+
+ if (datatype == GL_FLOAT) {
+ desc->unpack_rgba_float((float *)dst, dst_stride * sizeof(GLfloat), src, src_stride, width, height);
+ if (width < bw || height < bh) {
+ float *dst_p = (float *)dst;
+ /* We're decompressing an image smaller than the compression
+ * block size. We don't want garbage pixel values in the region
+ * outside (width x height) so replicate pixels from the (width
+ * x height) region to fill out the (bw x bh) block size.
+ */
+ uint x, y;
+ for (y = 0; y < bh; y++) {
+ for (x = 0; x < bw; x++) {
+ if (x >= width || y >= height) {
+ uint p = (y * bw + x) * 4;
+ dst_p[p + 0] = dst_p[0];
+ dst_p[p + 1] = dst_p[1];
+ dst_p[p + 2] = dst_p[2];
+ dst_p[p + 3] = dst_p[3];
+ }
+ }
+ }
+ }
+ } else {
+ desc->unpack_rgba_8unorm((uint8_t *)dst, dst_stride, src, src_stride, width, height);
+ if (width < bw || height < bh) {
+ uint8_t *dst_p = (uint8_t *)dst;
+ /* We're decompressing an image smaller than the compression
+ * block size. We don't want garbage pixel values in the region
+ * outside (width x height) so replicate pixels from the (width
+ * x height) region to fill out the (bw x bh) block size.
+ */
+ uint x, y;
+ for (y = 0; y < bh; y++) {
+ for (x = 0; x < bw; x++) {
+ if (x >= width || y >= height) {
+ uint p = (y * bw + x) * 4;
+ dst_p[p + 0] = dst_p[0];
+ dst_p[p + 1] = dst_p[1];
+ dst_p[p + 2] = dst_p[2];
+ dst_p[p + 3] = dst_p[3];
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Helper function to compress an image. The source is a 32-bpp RGBA image
+ * with stride==width.
+ */
+static void
+compress_image(enum pipe_format format, int datatype,
+ const void *src, uint8_t *dst,
+ unsigned width, unsigned height, unsigned dst_stride)
+{
+ const struct util_format_description *desc = util_format_description(format);
+ const uint src_stride = 4 * width;
+
+ if (datatype == GL_FLOAT)
+ desc->pack_rgba_float(dst, dst_stride, (GLfloat *)src, src_stride * sizeof(GLfloat), width, height);
+ else
+ desc->pack_rgba_8unorm(dst, dst_stride, (uint8_t *)src, src_stride, width, height);
+}
+
+
+/**
+ * Software fallback for generate mipmap levels.
+ */
+static void
+fallback_generate_mipmap(struct gl_context *ctx, GLenum target,
+ struct gl_texture_object *texObj)
+{
+ struct pipe_context *pipe = st_context(ctx)->pipe;
+ struct pipe_resource *pt = st_get_texobj_resource(texObj);
+ const uint baseLevel = texObj->BaseLevel;
+ const uint lastLevel = pt->last_level;
+ const uint face = _mesa_tex_target_to_face(target);
+ uint dstLevel;
+ GLenum datatype;
+ GLuint comps;
+ GLboolean compressed;
+
+ if (ST_DEBUG & DEBUG_FALLBACK)
+ debug_printf("%s: fallback processing\n", __FUNCTION__);
+
+ assert(target != GL_TEXTURE_3D); /* not done yet */
+
+ compressed =
+ _mesa_is_format_compressed(texObj->Image[face][baseLevel]->TexFormat);
+
+ if (compressed) {
+ GLenum type =
+ _mesa_get_format_datatype(texObj->Image[face][baseLevel]->TexFormat);
+
+ datatype = type == GL_UNSIGNED_NORMALIZED ? GL_UNSIGNED_BYTE : GL_FLOAT;
+ comps = 4;
+ }
+ else {
+ _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat,
+ &datatype, &comps);
+ assert(comps > 0 && "bad texture format in fallback_generate_mipmap()");
+ }
+
+ for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
+ const uint srcLevel = dstLevel - 1;
+ const uint srcWidth = u_minify(pt->width0, srcLevel);
+ const uint srcHeight = u_minify(pt->height0, srcLevel);
+ const uint srcDepth = u_minify(pt->depth0, srcLevel);
+ const uint dstWidth = u_minify(pt->width0, dstLevel);
+ const uint dstHeight = u_minify(pt->height0, dstLevel);
+ const uint dstDepth = u_minify(pt->depth0, dstLevel);
+ struct pipe_transfer *srcTrans, *dstTrans;
+ const ubyte *srcData;
+ ubyte *dstData;
+ int srcStride, dstStride;
+
+ srcTrans = pipe_get_transfer(pipe, pt, srcLevel,
+ face,
+ PIPE_TRANSFER_READ, 0, 0,
+ srcWidth, srcHeight);
+
+ dstTrans = pipe_get_transfer(pipe, pt, dstLevel,
+ face,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ dstWidth, dstHeight);
+
+ srcData = (ubyte *) pipe_transfer_map(pipe, srcTrans);
+ dstData = (ubyte *) pipe_transfer_map(pipe, dstTrans);
+
+ srcStride = srcTrans->stride / util_format_get_blocksize(srcTrans->resource->format);
+ dstStride = dstTrans->stride / util_format_get_blocksize(dstTrans->resource->format);
+
+ /* this cannot work correctly for 3d since it does
+ not respect layerStride. */
+ if (compressed) {
+ const enum pipe_format format = pt->format;
+ const uint bw = util_format_get_blockwidth(format);
+ const uint bh = util_format_get_blockheight(format);
+ const uint srcWidth2 = align(srcWidth, bw);
+ const uint srcHeight2 = align(srcHeight, bh);
+ const uint dstWidth2 = align(dstWidth, bw);
+ const uint dstHeight2 = align(dstHeight, bh);
+ uint8_t *srcTemp, *dstTemp;
+
+ assert(comps == 4);
+
+ srcTemp = malloc(srcWidth2 * srcHeight2 * comps * (datatype == GL_FLOAT ? 4 : 1));
+ dstTemp = malloc(dstWidth2 * dstHeight2 * comps * (datatype == GL_FLOAT ? 4 : 1));
+
+ /* decompress the src image: srcData -> srcTemp */
+ decompress_image(format, datatype, srcData, srcTemp, srcWidth2, srcHeight2, srcTrans->stride);
+
+ _mesa_generate_mipmap_level(target, datatype, comps,
+ 0 /*border*/,
+ srcWidth2, srcHeight2, srcDepth,
+ srcTemp,
+ srcWidth2, /* stride in texels */
+ dstWidth2, dstHeight2, dstDepth,
+ dstTemp,
+ dstWidth2); /* stride in texels */
+
+ /* compress the new image: dstTemp -> dstData */
+ compress_image(format, datatype, dstTemp, dstData, dstWidth2, dstHeight2, dstTrans->stride);
+
+ free(srcTemp);
+ free(dstTemp);
+ }
+ else {
+ _mesa_generate_mipmap_level(target, datatype, comps,
+ 0 /*border*/,
+ srcWidth, srcHeight, srcDepth,
+ srcData,
+ srcStride, /* stride in texels */
+ dstWidth, dstHeight, dstDepth,
+ dstData,
+ dstStride); /* stride in texels */
+ }
+
+ pipe_transfer_unmap(pipe, srcTrans);
+ pipe_transfer_unmap(pipe, dstTrans);
+
+ pipe->transfer_destroy(pipe, srcTrans);
+ pipe->transfer_destroy(pipe, dstTrans);
+ }
+}
+
+
+/**
+ * Compute the expected number of mipmap levels in the texture given
+ * the width/height/depth of the base image and the GL_TEXTURE_BASE_LEVEL/
+ * GL_TEXTURE_MAX_LEVEL settings. This will tell us how many mipmap
+ * levels should be generated.
+ */
+static GLuint
+compute_num_levels(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLenum target)
+{
+ if (target == GL_TEXTURE_RECTANGLE_ARB) {
+ return 1;
+ }
+ else {
+ const struct gl_texture_image *baseImage =
+ _mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel);
+ GLuint size, numLevels;
+
+ size = MAX2(baseImage->Width2, baseImage->Height2);
+ size = MAX2(size, baseImage->Depth2);
+
+ numLevels = texObj->BaseLevel;
+
+ while (size > 0) {
+ numLevels++;
+ size >>= 1;
+ }
+
+ numLevels = MIN2(numLevels, texObj->MaxLevel + 1);
+
+ assert(numLevels >= 1);
+
+ return numLevels;
+ }
+}
+
+
+/**
+ * Called via ctx->Driver.GenerateMipmap().
+ */
+void
+st_generate_mipmap(struct gl_context *ctx, GLenum target,
+ struct gl_texture_object *texObj)
+{
+ struct st_context *st = st_context(ctx);
+ struct st_texture_object *stObj = st_texture_object(texObj);
+ struct pipe_resource *pt = st_get_texobj_resource(texObj);
+ const uint baseLevel = texObj->BaseLevel;
+ uint lastLevel;
+ uint dstLevel;
+
+ if (!pt)
+ return;
+
+ /* not sure if this ultimately actually should work,
+ but we're not supporting multisampled textures yet. */
+ assert(pt->nr_samples < 2);
+
+ /* find expected last mipmap level to generate*/
+ lastLevel = compute_num_levels(ctx, texObj, target) - 1;
+
+ if (lastLevel == 0)
+ return;
+
+ /* The texture isn't in a "complete" state yet so set the expected
+ * lastLevel here, since it won't get done in st_finalize_texture().
+ */
+ stObj->lastLevel = lastLevel;
+
+ if (pt->last_level < lastLevel) {
+ /* The current gallium texture doesn't have space for all the
+ * mipmap levels we need to generate. So allocate a new texture.
+ */
+ struct pipe_resource *oldTex = stObj->pt;
+
+ /* create new texture with space for more levels */
+ stObj->pt = st_texture_create(st,
+ oldTex->target,
+ oldTex->format,
+ lastLevel,
+ oldTex->width0,
+ oldTex->height0,
+ oldTex->depth0,
+ oldTex->array_size,
+ oldTex->bind);
+
+ /* This will copy the old texture's base image into the new texture
+ * which we just allocated.
+ */
+ st_finalize_texture(ctx, st->pipe, texObj);
+
+ /* release the old tex (will likely be freed too) */
+ pipe_resource_reference(&oldTex, NULL);
+ pipe_sampler_view_reference(&stObj->sampler_view, NULL);
+ }
+ else {
+ /* Make sure that the base texture image data is present in the
+ * texture buffer.
+ */
+ st_finalize_texture(ctx, st->pipe, texObj);
+ }
+
+ pt = stObj->pt;
+
+ assert(pt->last_level >= lastLevel);
+
+ /* Try to generate the mipmap by rendering/texturing. If that fails,
+ * use the software fallback.
+ */
+ if (!st_render_mipmap(st, target, stObj, baseLevel, lastLevel)) {
+ /* since the util code actually also has a fallback, should
+ probably make it never fail and kill this */
+ fallback_generate_mipmap(ctx, target, texObj);
+ }
+
+ /* Fill in the Mesa gl_texture_image fields */
+ for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) {
+ const uint srcLevel = dstLevel - 1;
+ const struct gl_texture_image *srcImage
+ = _mesa_get_tex_image(ctx, texObj, target, srcLevel);
+ struct gl_texture_image *dstImage;
+ struct st_texture_image *stImage;
+ uint dstWidth = u_minify(pt->width0, dstLevel);
+ uint dstHeight = u_minify(pt->height0, dstLevel);
+ uint dstDepth = u_minify(pt->depth0, dstLevel);
+ uint border = srcImage->Border;
+
+ dstImage = _mesa_get_tex_image(ctx, texObj, target, dstLevel);
+ if (!dstImage) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
+ return;
+ }
+
+ /* Free old image data */
+ if (dstImage->Data)
+ ctx->Driver.FreeTexImageData(ctx, dstImage);
+
+ /* initialize new image */
+ _mesa_init_teximage_fields(ctx, target, dstImage, dstWidth, dstHeight,
+ dstDepth, border, srcImage->InternalFormat,
+ srcImage->TexFormat);
+
+ stImage = st_texture_image(dstImage);
+ stImage->level = dstLevel;
+
+ pipe_resource_reference(&stImage->pt, pt);
+ }
+}
diff --git a/mkfontscale/list.h b/mkfontscale/list.h
index 8b3c82f74..42e4c0756 100644
--- a/mkfontscale/list.h
+++ b/mkfontscale/list.h
@@ -23,7 +23,9 @@
#ifndef _MKS_LIST_H_
#define _MKS_LIST_H_ 1
-char *dsprintf(char *f, ...);
+#include <X11/Xfuncproto.h> /* for _X_ATTRIBUTE_PRINTF */
+
+char *dsprintf(char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
typedef struct _List {
char *value;
@@ -33,8 +35,8 @@ typedef struct _List {
int listMember(char *elt, ListPtr list);
ListPtr listCons(char *car, ListPtr cdr);
ListPtr listAdjoin(char *car, ListPtr cdr);
-ListPtr listConsF(ListPtr cdr, char *f, ...);
-ListPtr listAdjoinF(ListPtr cdr, char *f, ...);
+ListPtr listConsF(ListPtr cdr, char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
+ListPtr listAdjoinF(ListPtr cdr, char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
int listLength(ListPtr list);
ListPtr appendList(ListPtr first, ListPtr second);
ListPtr makeList(char **a, int n, ListPtr old, int begin);
diff --git a/pixman/pixman/Makefile.win32 b/pixman/pixman/Makefile.win32
index c5e8dfaf2..f54a16f2a 100644
--- a/pixman/pixman/Makefile.win32
+++ b/pixman/pixman/Makefile.win32
@@ -49,6 +49,7 @@ SOURCES = \
pixman-radial-gradient.c \
pixman-bits-image.c \
pixman.c \
+ pixman-noop.c \
pixman-cpu.c \
pixman-fast-path.c \
pixman-implementation.c \
diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c
index 627badda6..803f28a15 100644
--- a/xorg-server/dix/devices.c
+++ b/xorg-server/dix/devices.c
@@ -1369,15 +1369,6 @@ InitPointerAccelerationScheme(DeviceIntPtr dev,
}
Bool
-InitAbsoluteClassDeviceStruct(DeviceIntPtr dev)
-{
- /* This is an API-preserving noop. Instructions: Kill when no more drivers
- * call it. The infrastructure behind hasn't really been used, so any calls
- * are likely just a declaration that the device is absolute. */
- return FALSE;
-}
-
-Bool
InitFocusClassDeviceStruct(DeviceIntPtr dev)
{
FocusClassPtr focc;
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 20b35cdf1..1c8ec53a4 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -112,6 +112,7 @@ Equipment Corporation.
#include <X11/Xproto.h>
#include "windowstr.h"
#include "inputstr.h"
+#include "inpututils.h"
#include "scrnintstr.h"
#include "cursorstr.h"
@@ -2198,7 +2199,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
*/
if (!grab && ActivateImplicitGrab(pDev, client, pWin, pEvents, deliveryMask))
/* grab activated */;
- else if ((type == MotionNotify))
+ else if (type == MotionNotify)
pDev->valuator->motionHintWindow = pWin;
else if (type == DeviceMotionNotify || type == DeviceButtonPress)
CheckDeviceGrabAndHintWindow (pWin, type,
@@ -2835,7 +2836,7 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
WindowPtr prevSpriteWin, newSpriteWin;
SpritePtr pSprite = pDev->spriteInfo->sprite;
- verify_internal_event(ev);
+ verify_internal_event((InternalEvent *)ev);
if (!pSprite)
return FALSE;
@@ -5912,7 +5913,7 @@ PickPointer(ClientPtr client)
if (!client->clientPtr)
{
- DeviceIntPtr it = inputInfo.devices;
+ it = inputInfo.devices;
while (it)
{
if (IsMaster(it) && it->spriteInfo->spriteOwner)
diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c
index 9d2bc3246..4565e6e68 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -574,7 +574,7 @@ void verify_internal_event(const InternalEvent *ev)
for (i = 0; i < sizeof(xEvent); i++, data++)
{
- ErrorF("%02hx ", *data);
+ ErrorF("%02hhx ", *data);
if ((i % 8) == 7)
ErrorF("\n");
diff --git a/xorg-server/fb/fbbltone.c b/xorg-server/fb/fbbltone.c
index 0e95aa3ff..e429b1b35 100644
--- a/xorg-server/fb/fbbltone.c
+++ b/xorg-server/fb/fbbltone.c
@@ -428,8 +428,8 @@ fbBltOne (FbStip *src,
#define Mask24(x,r) (Mask24Pos(x,r) < FB_UNIT ? \
(Mask24Pos(x,r) < 0 ? \
- 0xffffff >> Mask24Neg (x,r) : \
- 0xffffff << Mask24Check(x,r)) : 0)
+ 0xffffffU >> Mask24Neg (x,r) : \
+ 0xffffffU << Mask24Check(x,r)) : 0)
#define SelMask24(b,n,r) ((((b) >> n) & 1) * Mask24(n,r))
diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c
index 4519398a9..b08dc1e40 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyr.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyr.c
@@ -52,6 +52,7 @@ Bool ephyrNoDRI=FALSE ;
Bool ephyrNoXV=FALSE ;
static int mouseState = 0;
+static Rotation ephyrRandr = RR_Rotate_0;
typedef struct _EphyrInputPrivate {
Bool enabled;
@@ -252,7 +253,11 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
EPHYR_LOG("screen->width: %d, screen->height: %d index=%d",
screen->width, screen->height, screen->mynum);
- KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
+ /*
+ * Use the rotation last applied to ourselves (in the Xephyr case the fb
+ * coordinate system moves independently of the pointer coordiante system).
+ */
+ KdComputePointerMatrix (&m, ephyrRandr, screen->width, screen->height);
KdSetPointerMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
@@ -533,7 +538,15 @@ ephyrRandRSetConfig (ScreenPtr pScreen,
* Set new configuration
*/
- scrpriv->randr = KdAddRotation (screen->randr, randr);
+ /*
+ * We need to store the rotation value for pointer coords transformation;
+ * though initially the pointer and fb rotation are identical, when we map
+ * the fb, the screen will be reinitialized and return into an unrotated
+ * state (presumably the HW is taking care of the rotation of the fb), but the
+ * pointer still needs to be transformed.
+ */
+ ephyrRandr = KdAddRotation (screen->randr, randr);
+ scrpriv->randr = ephyrRandr;
ephyrUnmapFramebuffer (screen);
@@ -1069,6 +1082,14 @@ MouseInit (KdPointerInfo *pi)
pi->nButtons = 32;
free(pi->name);
pi->name = strdup("Xephyr virtual mouse");
+
+ /*
+ * Must transform pointer coords since the pointer position
+ * relative to the Xephyr window is controlled by the host server and
+ * remains constant regardless of any rotation applied to the Xephyr screen.
+ */
+ pi->transformCoordinates = TRUE;
+
ephyrMouse = pi;
return Success;
}
diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
index b90b92bac..9be68b08b 100644
--- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c
+++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c
@@ -370,13 +370,18 @@ ephyrDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
return TRUE;
}
+static void
+ephyrDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+}
+
miPointerSpriteFuncRec EphyrPointerSpriteFuncs = {
ephyrRealizeCursor,
ephyrUnrealizeCursor,
ephyrSetCursor,
ephyrMoveCursor,
ephyrDeviceCursorInitialize,
- NULL
+ ephyrDeviceCursorCleanup
};
diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h
index 02fdab608..f5f182b25 100644
--- a/xorg-server/hw/xfree86/common/xf86Module.h
+++ b/xorg-server/hw/xfree86/common/xf86Module.h
@@ -83,7 +83,7 @@ typedef enum {
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(11, 0)
-#define ABI_XINPUT_VERSION SET_ABI_VERSION(12, 2)
+#define ABI_XINPUT_VERSION SET_ABI_VERSION(13, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(5, 0)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index b8d866429..afef0994d 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -470,6 +470,20 @@ match_path_pattern(const char *attr, const char *pattern)
#endif
/*
+ * If no Layout section is found, xf86ServerLayout.id becomes "(implicit)"
+ * It is convenient that "" in patterns means "no explicit layout"
+ */
+static int
+match_string_implicit(const char *attr, const char *pattern)
+{
+ if (strlen(pattern)) {
+ return strcmp(attr, pattern);
+ } else {
+ return strcmp(attr,"(implicit)");
+ }
+}
+
+/*
* Match an attribute against a list of NULL terminated arrays of patterns.
* If a pattern in each list entry is matched, return TRUE.
*/
@@ -564,6 +578,13 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
return FALSE;
}
+ /* MatchLayout string */
+ if (!list_is_empty(&iclass->match_layout)) {
+ if (!MatchAttrToken(xf86ConfigLayout.id,
+ &iclass->match_layout, match_string_implicit))
+ return FALSE;
+ }
+
/* MatchIs* booleans */
if (iclass->is_keyboard.set &&
iclass->is_keyboard.val != !!(attrs->flags & ATTR_KEYBOARD))
diff --git a/xorg-server/hw/xfree86/man/xorg.conf.man b/xorg-server/hw/xfree86/man/xorg.conf.man
index ce0c177bc..5379fdc45 100644
--- a/xorg-server/hw/xfree86/man/xorg.conf.man
+++ b/xorg-server/hw/xfree86/man/xorg.conf.man
@@ -1140,6 +1140,16 @@ matches the
pattern. A match is found if at least one of the tags given in
.RI \*q matchtag \*q
matches at least one of the tags assigned by the backend.
+.TP 7
+.BI "MatchLayout \*q" matchlayout \*q
+Check the case-sensitive string
+.RI \*q matchlayout \*q
+against the currently active
+.B ServerLayout
+section. The empty string "" matches an implicit layout which appears
+if no named
+.B ServerLayout
+sections have been found.
.PP
The second type of entry is used to match device types. These entries take a
boolean argument similar to
diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c
index ddf344a0f..3f801700e 100644
--- a/xorg-server/hw/xfree86/parser/InputClass.c
+++ b/xorg-server/hw/xfree86/parser/InputClass.c
@@ -1,403 +1,424 @@
-/*
- * Copyright (c) 2009 Dan Nicholson
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-/* View/edit this file with tab stops set to 4 */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-#include "os.h"
-#include "xf86Parser.h"
-#include "xf86tokens.h"
-#include "Configint.h"
-
-extern LexRec val;
-
-static
-xf86ConfigSymTabRec InputClassTab[] =
-{
- {ENDSECTION, "endsection"},
- {IDENTIFIER, "identifier"},
- {OPTION, "option"},
- {DRIVER, "driver"},
- {MATCH_PRODUCT, "matchproduct"},
- {MATCH_VENDOR, "matchvendor"},
- {MATCH_DEVICE_PATH, "matchdevicepath"},
- {MATCH_OS, "matchos"},
- {MATCH_PNPID, "matchpnpid"},
- {MATCH_USBID, "matchusbid"},
- {MATCH_DRIVER, "matchdriver"},
- {MATCH_TAG, "matchtag"},
- {MATCH_IS_KEYBOARD, "matchiskeyboard"},
- {MATCH_IS_POINTER, "matchispointer"},
- {MATCH_IS_JOYSTICK, "matchisjoystick"},
- {MATCH_IS_TABLET, "matchistablet"},
- {MATCH_IS_TOUCHPAD, "matchistouchpad"},
- {MATCH_IS_TOUCHSCREEN, "matchistouchscreen"},
- {-1, ""},
-};
-
-#define CLEANUP xf86freeInputClassList
-
-#define TOKEN_SEP "|"
-
-static void
-add_group_entry(struct list *head, char **values)
-{
- xf86MatchGroup *group;
-
- group = malloc(sizeof(*group));
- if (group) {
- group->values = values;
- list_add(&group->entry, head);
- }
-}
-
-XF86ConfInputClassPtr
-xf86parseInputClassSection(void)
-{
- int has_ident = FALSE;
- int token;
-
- parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec)
-
- /* Initialize MatchGroup lists */
- list_init(&ptr->match_product);
- list_init(&ptr->match_vendor);
- list_init(&ptr->match_device);
- list_init(&ptr->match_os);
- list_init(&ptr->match_pnpid);
- list_init(&ptr->match_usbid);
- list_init(&ptr->match_driver);
- list_init(&ptr->match_tag);
-
- while ((token = xf86getToken(InputClassTab)) != ENDSECTION) {
- switch (token) {
- case COMMENT:
- ptr->comment = xf86addComment(ptr->comment, val.str);
- break;
- case IDENTIFIER:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "Identifier");
- if (has_ident == TRUE)
- Error(MULTIPLE_MSG, "Identifier");
- ptr->identifier = val.str;
- has_ident = TRUE;
- break;
- case DRIVER:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "Driver");
- if (strcmp(val.str, "keyboard") == 0) {
- ptr->driver = strdup("kbd");
- free(val.str);
- }
- else
- ptr->driver = val.str;
- break;
- case OPTION:
- ptr->option_lst = xf86parseOption(ptr->option_lst);
- break;
- case MATCH_PRODUCT:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchProduct");
- add_group_entry(&ptr->match_product,
- xstrtokenize(val.str, TOKEN_SEP));
- break;
- case MATCH_VENDOR:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchVendor");
- add_group_entry(&ptr->match_vendor,
- xstrtokenize(val.str, TOKEN_SEP));
- break;
- case MATCH_DEVICE_PATH:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchDevicePath");
- add_group_entry(&ptr->match_device,
- xstrtokenize(val.str, TOKEN_SEP));
- break;
- case MATCH_OS:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchOS");
- add_group_entry(&ptr->match_os,
- xstrtokenize(val.str, TOKEN_SEP));
- break;
- case MATCH_PNPID:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchPnPID");
- add_group_entry(&ptr->match_pnpid,
- xstrtokenize(val.str, TOKEN_SEP));
- break;
- case MATCH_USBID:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchUSBID");
- add_group_entry(&ptr->match_usbid,
- xstrtokenize(val.str, TOKEN_SEP));
- break;
- case MATCH_DRIVER:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchDriver");
- add_group_entry(&ptr->match_driver,
- xstrtokenize(val.str, TOKEN_SEP));
- break;
- case MATCH_TAG:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchTag");
- add_group_entry(&ptr->match_tag,
- xstrtokenize(val.str, TOKEN_SEP));
- break;
- case MATCH_IS_KEYBOARD:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchIsKeyboard");
- ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val,
- val.str);
- if (!ptr->is_keyboard.set)
- Error(BOOL_MSG, "MatchIsKeyboard");
- break;
- case MATCH_IS_POINTER:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchIsPointer");
- ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val,
- val.str);
- if (!ptr->is_pointer.set)
- Error(BOOL_MSG, "MatchIsPointer");
- break;
- case MATCH_IS_JOYSTICK:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchIsJoystick");
- ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val,
- val.str);
- if (!ptr->is_joystick.set)
- Error(BOOL_MSG, "MatchIsJoystick");
- break;
- case MATCH_IS_TABLET:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchIsTablet");
- ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val,
- val.str);
- if (!ptr->is_tablet.set)
- Error(BOOL_MSG, "MatchIsTablet");
- break;
- case MATCH_IS_TOUCHPAD:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchIsTouchpad");
- ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val,
- val.str);
- if (!ptr->is_touchpad.set)
- Error(BOOL_MSG, "MatchIsTouchpad");
- break;
- case MATCH_IS_TOUCHSCREEN:
- if (xf86getSubToken(&(ptr->comment)) != STRING)
- Error(QUOTE_MSG, "MatchIsTouchscreen");
- ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val,
- val.str);
- if (!ptr->is_touchscreen.set)
- Error(BOOL_MSG, "MatchIsTouchscreen");
- break;
- case EOF_TOKEN:
- Error(UNEXPECTED_EOF_MSG, NULL);
- break;
- default:
- Error(INVALID_KEYWORD_MSG, xf86tokenString ());
- break;
- }
- }
-
- if (!has_ident)
- Error(NO_IDENT_MSG, NULL);
-
-#ifdef DEBUG
- printf("InputClass section parsed\n");
-#endif
-
- return ptr;
-}
-
-void
-xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
-{
- const xf86MatchGroup *group;
- char * const *cur;
-
- while (ptr) {
- fprintf(cf, "Section \"InputClass\"\n");
- if (ptr->comment)
- fprintf(cf, "%s", ptr->comment);
- if (ptr->identifier)
- fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier);
- if (ptr->driver)
- fprintf(cf, "\tDriver \"%s\"\n", ptr->driver);
-
- list_for_each_entry(group, &ptr->match_product, entry) {
- fprintf(cf, "\tMatchProduct \"");
- for (cur = group->values; *cur; cur++)
- fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
- *cur);
- fprintf(cf, "\"\n");
- }
- list_for_each_entry(group, &ptr->match_vendor, entry) {
- fprintf(cf, "\tMatchVendor \"");
- for (cur = group->values; *cur; cur++)
- fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
- *cur);
- fprintf(cf, "\"\n");
- }
- list_for_each_entry(group, &ptr->match_device, entry) {
- fprintf(cf, "\tMatchDevicePath \"");
- for (cur = group->values; *cur; cur++)
- fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
- *cur);
- fprintf(cf, "\"\n");
- }
- list_for_each_entry(group, &ptr->match_os, entry) {
- fprintf(cf, "\tMatchOS \"");
- for (cur = group->values; *cur; cur++)
- fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
- *cur);
- fprintf(cf, "\"\n");
- }
- list_for_each_entry(group, &ptr->match_pnpid, entry) {
- fprintf(cf, "\tMatchPnPID \"");
- for (cur = group->values; *cur; cur++)
- fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
- *cur);
- fprintf(cf, "\"\n");
- }
- list_for_each_entry(group, &ptr->match_usbid, entry) {
- fprintf(cf, "\tMatchUSBID \"");
- for (cur = group->values; *cur; cur++)
- fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
- *cur);
- fprintf(cf, "\"\n");
- }
- list_for_each_entry(group, &ptr->match_driver, entry) {
- fprintf(cf, "\tMatchDriver \"");
- for (cur = group->values; *cur; cur++)
- fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
- *cur);
- fprintf(cf, "\"\n");
- }
- list_for_each_entry(group, &ptr->match_tag, entry) {
- fprintf(cf, "\tMatchTag \"");
- for (cur = group->values; *cur; cur++)
- fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
- *cur);
- fprintf(cf, "\"\n");
- }
-
- if (ptr->is_keyboard.set)
- fprintf(cf, "\tIsKeyboard \"%s\"\n",
- ptr->is_keyboard.val ? "yes" : "no");
- if (ptr->is_pointer.set)
- fprintf(cf, "\tIsPointer \"%s\"\n",
- ptr->is_pointer.val ? "yes" : "no");
- if (ptr->is_joystick.set)
- fprintf(cf, "\tIsJoystick \"%s\"\n",
- ptr->is_joystick.val ? "yes" : "no");
- if (ptr->is_tablet.set)
- fprintf(cf, "\tIsTablet \"%s\"\n",
- ptr->is_tablet.val ? "yes" : "no");
- if (ptr->is_touchpad.set)
- fprintf(cf, "\tIsTouchpad \"%s\"\n",
- ptr->is_touchpad.val ? "yes" : "no");
- if (ptr->is_touchscreen.set)
- fprintf(cf, "\tIsTouchscreen \"%s\"\n",
- ptr->is_touchscreen.val ? "yes" : "no");
- xf86printOptionList(cf, ptr->option_lst, 1);
- fprintf(cf, "EndSection\n\n");
- ptr = ptr->list.next;
- }
-}
-
-void
-xf86freeInputClassList (XF86ConfInputClassPtr ptr)
-{
- XF86ConfInputClassPtr prev;
-
- while (ptr) {
- xf86MatchGroup *group, *next;
- char **list;
-
- TestFree(ptr->identifier);
- TestFree(ptr->driver);
-
- list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
- list_del(&group->entry);
- for (list = group->values; *list; list++)
- free(*list);
- free(group);
- }
- list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
- list_del(&group->entry);
- for (list = group->values; *list; list++)
- free(*list);
- free(group);
- }
- list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
- list_del(&group->entry);
- for (list = group->values; *list; list++)
- free(*list);
- free(group);
- }
- list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
- list_del(&group->entry);
- for (list = group->values; *list; list++)
- free(*list);
- free(group);
- }
- list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
- list_del(&group->entry);
- for (list = group->values; *list; list++)
- free(*list);
- free(group);
- }
- list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
- list_del(&group->entry);
- for (list = group->values; *list; list++)
- free(*list);
- free(group);
- }
- list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
- list_del(&group->entry);
- for (list = group->values; *list; list++)
- free(*list);
- free(group);
- }
- list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
- list_del(&group->entry);
- for (list = group->values; *list; list++)
- free(*list);
- free(group);
- }
-
- TestFree(ptr->comment);
- xf86optionListFree(ptr->option_lst);
-
- prev = ptr;
- ptr = ptr->list.next;
- free(prev);
- }
-}
+/*
+ * Copyright (c) 2009 Dan Nicholson
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/* View/edit this file with tab stops set to 4 */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+#include "os.h"
+#include "xf86Parser.h"
+#include "xf86tokens.h"
+#include "Configint.h"
+
+extern LexRec val;
+
+static
+xf86ConfigSymTabRec InputClassTab[] =
+{
+ {ENDSECTION, "endsection"},
+ {IDENTIFIER, "identifier"},
+ {OPTION, "option"},
+ {DRIVER, "driver"},
+ {MATCH_PRODUCT, "matchproduct"},
+ {MATCH_VENDOR, "matchvendor"},
+ {MATCH_DEVICE_PATH, "matchdevicepath"},
+ {MATCH_OS, "matchos"},
+ {MATCH_PNPID, "matchpnpid"},
+ {MATCH_USBID, "matchusbid"},
+ {MATCH_DRIVER, "matchdriver"},
+ {MATCH_TAG, "matchtag"},
+ {MATCH_LAYOUT, "matchlayout"},
+ {MATCH_IS_KEYBOARD, "matchiskeyboard"},
+ {MATCH_IS_POINTER, "matchispointer"},
+ {MATCH_IS_JOYSTICK, "matchisjoystick"},
+ {MATCH_IS_TABLET, "matchistablet"},
+ {MATCH_IS_TOUCHPAD, "matchistouchpad"},
+ {MATCH_IS_TOUCHSCREEN, "matchistouchscreen"},
+ {-1, ""},
+};
+
+#define CLEANUP xf86freeInputClassList
+
+#define TOKEN_SEP "|"
+
+static void
+add_group_entry(struct list *head, char **values)
+{
+ xf86MatchGroup *group;
+
+ group = malloc(sizeof(*group));
+ if (group) {
+ group->values = values;
+ list_add(&group->entry, head);
+ }
+}
+
+XF86ConfInputClassPtr
+xf86parseInputClassSection(void)
+{
+ int has_ident = FALSE;
+ int token;
+
+ parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec)
+
+ /* Initialize MatchGroup lists */
+ list_init(&ptr->match_product);
+ list_init(&ptr->match_vendor);
+ list_init(&ptr->match_device);
+ list_init(&ptr->match_os);
+ list_init(&ptr->match_pnpid);
+ list_init(&ptr->match_usbid);
+ list_init(&ptr->match_driver);
+ list_init(&ptr->match_tag);
+ list_init(&ptr->match_layout);
+
+ while ((token = xf86getToken(InputClassTab)) != ENDSECTION) {
+ switch (token) {
+ case COMMENT:
+ ptr->comment = xf86addComment(ptr->comment, val.str);
+ break;
+ case IDENTIFIER:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "Identifier");
+ if (has_ident == TRUE)
+ Error(MULTIPLE_MSG, "Identifier");
+ ptr->identifier = val.str;
+ has_ident = TRUE;
+ break;
+ case DRIVER:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "Driver");
+ if (strcmp(val.str, "keyboard") == 0) {
+ ptr->driver = strdup("kbd");
+ free(val.str);
+ }
+ else
+ ptr->driver = val.str;
+ break;
+ case OPTION:
+ ptr->option_lst = xf86parseOption(ptr->option_lst);
+ break;
+ case MATCH_PRODUCT:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchProduct");
+ add_group_entry(&ptr->match_product,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
+ case MATCH_VENDOR:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchVendor");
+ add_group_entry(&ptr->match_vendor,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
+ case MATCH_DEVICE_PATH:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchDevicePath");
+ add_group_entry(&ptr->match_device,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
+ case MATCH_OS:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchOS");
+ add_group_entry(&ptr->match_os,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
+ case MATCH_PNPID:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchPnPID");
+ add_group_entry(&ptr->match_pnpid,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
+ case MATCH_USBID:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchUSBID");
+ add_group_entry(&ptr->match_usbid,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
+ case MATCH_DRIVER:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchDriver");
+ add_group_entry(&ptr->match_driver,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
+ case MATCH_TAG:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchTag");
+ add_group_entry(&ptr->match_tag,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
+ case MATCH_LAYOUT:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchLayout");
+ add_group_entry(&ptr->match_layout,
+ xstrtokenize(val.str, TOKEN_SEP));
+ break;
+ case MATCH_IS_KEYBOARD:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchIsKeyboard");
+ ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val,
+ val.str);
+ if (!ptr->is_keyboard.set)
+ Error(BOOL_MSG, "MatchIsKeyboard");
+ break;
+ case MATCH_IS_POINTER:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchIsPointer");
+ ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val,
+ val.str);
+ if (!ptr->is_pointer.set)
+ Error(BOOL_MSG, "MatchIsPointer");
+ break;
+ case MATCH_IS_JOYSTICK:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchIsJoystick");
+ ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val,
+ val.str);
+ if (!ptr->is_joystick.set)
+ Error(BOOL_MSG, "MatchIsJoystick");
+ break;
+ case MATCH_IS_TABLET:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchIsTablet");
+ ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val,
+ val.str);
+ if (!ptr->is_tablet.set)
+ Error(BOOL_MSG, "MatchIsTablet");
+ break;
+ case MATCH_IS_TOUCHPAD:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchIsTouchpad");
+ ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val,
+ val.str);
+ if (!ptr->is_touchpad.set)
+ Error(BOOL_MSG, "MatchIsTouchpad");
+ break;
+ case MATCH_IS_TOUCHSCREEN:
+ if (xf86getSubToken(&(ptr->comment)) != STRING)
+ Error(QUOTE_MSG, "MatchIsTouchscreen");
+ ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val,
+ val.str);
+ if (!ptr->is_touchscreen.set)
+ Error(BOOL_MSG, "MatchIsTouchscreen");
+ break;
+ case EOF_TOKEN:
+ Error(UNEXPECTED_EOF_MSG, NULL);
+ break;
+ default:
+ Error(INVALID_KEYWORD_MSG, xf86tokenString ());
+ break;
+ }
+ }
+
+ if (!has_ident)
+ Error(NO_IDENT_MSG, NULL);
+
+#ifdef DEBUG
+ printf("InputClass section parsed\n");
+#endif
+
+ return ptr;
+}
+
+void
+xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
+{
+ const xf86MatchGroup *group;
+ char * const *cur;
+
+ while (ptr) {
+ fprintf(cf, "Section \"InputClass\"\n");
+ if (ptr->comment)
+ fprintf(cf, "%s", ptr->comment);
+ if (ptr->identifier)
+ fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier);
+ if (ptr->driver)
+ fprintf(cf, "\tDriver \"%s\"\n", ptr->driver);
+
+ list_for_each_entry(group, &ptr->match_product, entry) {
+ fprintf(cf, "\tMatchProduct \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
+ list_for_each_entry(group, &ptr->match_vendor, entry) {
+ fprintf(cf, "\tMatchVendor \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
+ list_for_each_entry(group, &ptr->match_device, entry) {
+ fprintf(cf, "\tMatchDevicePath \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
+ list_for_each_entry(group, &ptr->match_os, entry) {
+ fprintf(cf, "\tMatchOS \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
+ list_for_each_entry(group, &ptr->match_pnpid, entry) {
+ fprintf(cf, "\tMatchPnPID \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
+ list_for_each_entry(group, &ptr->match_usbid, entry) {
+ fprintf(cf, "\tMatchUSBID \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
+ list_for_each_entry(group, &ptr->match_driver, entry) {
+ fprintf(cf, "\tMatchDriver \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
+ list_for_each_entry(group, &ptr->match_tag, entry) {
+ fprintf(cf, "\tMatchTag \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
+ list_for_each_entry(group, &ptr->match_layout, entry) {
+ fprintf(cf, "\tMatchLayout \"");
+ for (cur = group->values; *cur; cur++)
+ fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
+ *cur);
+ fprintf(cf, "\"\n");
+ }
+
+ if (ptr->is_keyboard.set)
+ fprintf(cf, "\tIsKeyboard \"%s\"\n",
+ ptr->is_keyboard.val ? "yes" : "no");
+ if (ptr->is_pointer.set)
+ fprintf(cf, "\tIsPointer \"%s\"\n",
+ ptr->is_pointer.val ? "yes" : "no");
+ if (ptr->is_joystick.set)
+ fprintf(cf, "\tIsJoystick \"%s\"\n",
+ ptr->is_joystick.val ? "yes" : "no");
+ if (ptr->is_tablet.set)
+ fprintf(cf, "\tIsTablet \"%s\"\n",
+ ptr->is_tablet.val ? "yes" : "no");
+ if (ptr->is_touchpad.set)
+ fprintf(cf, "\tIsTouchpad \"%s\"\n",
+ ptr->is_touchpad.val ? "yes" : "no");
+ if (ptr->is_touchscreen.set)
+ fprintf(cf, "\tIsTouchscreen \"%s\"\n",
+ ptr->is_touchscreen.val ? "yes" : "no");
+ xf86printOptionList(cf, ptr->option_lst, 1);
+ fprintf(cf, "EndSection\n\n");
+ ptr = ptr->list.next;
+ }
+}
+
+void
+xf86freeInputClassList (XF86ConfInputClassPtr ptr)
+{
+ XF86ConfInputClassPtr prev;
+
+ while (ptr) {
+ xf86MatchGroup *group, *next;
+ char **list;
+
+ TestFree(ptr->identifier);
+ TestFree(ptr->driver);
+
+ list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
+ list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
+ list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
+ list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
+ list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
+ list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
+ list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
+ list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
+ list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
+ list_del(&group->entry);
+ for (list = group->values; *list; list++)
+ free(*list);
+ free(group);
+ }
+
+ TestFree(ptr->comment);
+ xf86optionListFree(ptr->option_lst);
+
+ prev = ptr;
+ ptr = ptr->list.next;
+ free(prev);
+ }
+}
diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h
index bb7025dc4..a8785c5fa 100644
--- a/xorg-server/hw/xfree86/parser/xf86Parser.h
+++ b/xorg-server/hw/xfree86/parser/xf86Parser.h
@@ -1,518 +1,519 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-/*
- * This file contains the external interfaces for the XFree86 configuration
- * file parser.
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _xf86Parser_h_
-#define _xf86Parser_h_
-
-#include <X11/Xdefs.h>
-#include "xf86Optrec.h"
-#include "list.h"
-
-#define HAVE_PARSER_DECLS
-
-typedef struct
-{
- char *file_logfile;
- char *file_modulepath;
- char *file_fontpath;
- char *file_comment;
- char *file_xkbdir;
-}
-XF86ConfFilesRec, *XF86ConfFilesPtr;
-
-/* Values for load_type */
-#define XF86_LOAD_MODULE 0
-#define XF86_LOAD_DRIVER 1
-#define XF86_DISABLE_MODULE 2
-
-typedef struct
-{
- GenericListRec list;
- int load_type;
- char *load_name;
- XF86OptionPtr load_opt;
- char *load_comment;
- int ignore;
-}
-XF86LoadRec, *XF86LoadPtr;
-
-typedef struct
-{
- XF86LoadPtr mod_load_lst;
- XF86LoadPtr mod_disable_lst;
- char *mod_comment;
-}
-XF86ConfModuleRec, *XF86ConfModulePtr;
-
-#define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard"
-
-#define CONF_IMPLICIT_POINTER "Implicit Core Pointer"
-
-#define XF86CONF_PHSYNC 0x0001
-#define XF86CONF_NHSYNC 0x0002
-#define XF86CONF_PVSYNC 0x0004
-#define XF86CONF_NVSYNC 0x0008
-#define XF86CONF_INTERLACE 0x0010
-#define XF86CONF_DBLSCAN 0x0020
-#define XF86CONF_CSYNC 0x0040
-#define XF86CONF_PCSYNC 0x0080
-#define XF86CONF_NCSYNC 0x0100
-#define XF86CONF_HSKEW 0x0200 /* hskew provided */
-#define XF86CONF_BCAST 0x0400
-#define XF86CONF_VSCAN 0x1000
-
-typedef struct
-{
- GenericListRec list;
- char *ml_identifier;
- int ml_clock;
- int ml_hdisplay;
- int ml_hsyncstart;
- int ml_hsyncend;
- int ml_htotal;
- int ml_vdisplay;
- int ml_vsyncstart;
- int ml_vsyncend;
- int ml_vtotal;
- int ml_vscan;
- int ml_flags;
- int ml_hskew;
- char *ml_comment;
-}
-XF86ConfModeLineRec, *XF86ConfModeLinePtr;
-
-typedef struct
-{
- GenericListRec list;
- char *vp_identifier;
- XF86OptionPtr vp_option_lst;
- char *vp_comment;
-}
-XF86ConfVideoPortRec, *XF86ConfVideoPortPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *va_identifier;
- char *va_vendor;
- char *va_board;
- char *va_busid;
- char *va_driver;
- XF86OptionPtr va_option_lst;
- XF86ConfVideoPortPtr va_port_lst;
- char *va_fwdref;
- char *va_comment;
-}
-XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr;
-
-#define CONF_MAX_HSYNC 8
-#define CONF_MAX_VREFRESH 8
-
-typedef struct
-{
- float hi, lo;
-}
-parser_range;
-
-typedef struct
-{
- int red, green, blue;
-}
-parser_rgb;
-
-typedef struct
-{
- GenericListRec list;
- char *modes_identifier;
- XF86ConfModeLinePtr mon_modeline_lst;
- char *modes_comment;
-}
-XF86ConfModesRec, *XF86ConfModesPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *ml_modes_str;
- XF86ConfModesPtr ml_modes;
-}
-XF86ConfModesLinkRec, *XF86ConfModesLinkPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *mon_identifier;
- char *mon_vendor;
- char *mon_modelname;
- int mon_width; /* in mm */
- int mon_height; /* in mm */
- XF86ConfModeLinePtr mon_modeline_lst;
- int mon_n_hsync;
- parser_range mon_hsync[CONF_MAX_HSYNC];
- int mon_n_vrefresh;
- parser_range mon_vrefresh[CONF_MAX_VREFRESH];
- float mon_gamma_red;
- float mon_gamma_green;
- float mon_gamma_blue;
- XF86OptionPtr mon_option_lst;
- XF86ConfModesLinkPtr mon_modes_sect_lst;
- char *mon_comment;
-}
-XF86ConfMonitorRec, *XF86ConfMonitorPtr;
-
-#define CONF_MAXDACSPEEDS 4
-#define CONF_MAXCLOCKS 128
-
-typedef struct
-{
- GenericListRec list;
- char *dev_identifier;
- char *dev_vendor;
- char *dev_board;
- char *dev_chipset;
- char *dev_busid;
- char *dev_card;
- char *dev_driver;
- char *dev_ramdac;
- int dev_dacSpeeds[CONF_MAXDACSPEEDS];
- int dev_videoram;
- int dev_textclockfreq;
- unsigned long dev_bios_base;
- unsigned long dev_mem_base;
- unsigned long dev_io_base;
- char *dev_clockchip;
- int dev_clocks;
- int dev_clock[CONF_MAXCLOCKS];
- int dev_chipid;
- int dev_chiprev;
- int dev_irq;
- int dev_screen;
- XF86OptionPtr dev_option_lst;
- char *dev_comment;
-}
-XF86ConfDeviceRec, *XF86ConfDevicePtr;
-
-typedef struct
-{
- GenericListRec list;
- char *mode_name;
-}
-XF86ModeRec, *XF86ModePtr;
-
-typedef struct
-{
- GenericListRec list;
- int disp_frameX0;
- int disp_frameY0;
- int disp_virtualX;
- int disp_virtualY;
- int disp_depth;
- int disp_bpp;
- char *disp_visual;
- parser_rgb disp_weight;
- parser_rgb disp_black;
- parser_rgb disp_white;
- XF86ModePtr disp_mode_lst;
- XF86OptionPtr disp_option_lst;
- char *disp_comment;
-}
-XF86ConfDisplayRec, *XF86ConfDisplayPtr;
-
-typedef struct
-{
- XF86OptionPtr flg_option_lst;
- char *flg_comment;
-}
-XF86ConfFlagsRec, *XF86ConfFlagsPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *al_adaptor_str;
- XF86ConfVideoAdaptorPtr al_adaptor;
-}
-XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *scrn_identifier;
- char *scrn_obso_driver;
- int scrn_defaultdepth;
- int scrn_defaultbpp;
- int scrn_defaultfbbpp;
- char *scrn_monitor_str;
- XF86ConfMonitorPtr scrn_monitor;
- char *scrn_device_str;
- XF86ConfDevicePtr scrn_device;
- XF86ConfAdaptorLinkPtr scrn_adaptor_lst;
- XF86ConfDisplayPtr scrn_display_lst;
- XF86OptionPtr scrn_option_lst;
- char *scrn_comment;
- int scrn_virtualX, scrn_virtualY;
-}
-XF86ConfScreenRec, *XF86ConfScreenPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *inp_identifier;
- char *inp_driver;
- XF86OptionPtr inp_option_lst;
- char *inp_comment;
-}
-XF86ConfInputRec, *XF86ConfInputPtr;
-
-typedef struct
-{
- GenericListRec list;
- XF86ConfInputPtr iref_inputdev;
- char *iref_inputdev_str;
- XF86OptionPtr iref_option_lst;
-}
-XF86ConfInputrefRec, *XF86ConfInputrefPtr;
-
-typedef struct
-{
- Bool set;
- Bool val;
-}
-xf86TriState;
-
-typedef struct
-{
- struct list entry;
- char **values;
-}
-xf86MatchGroup;
-
-typedef struct
-{
- GenericListRec list;
- char *identifier;
- char *driver;
- struct list match_product;
- struct list match_vendor;
- struct list match_device;
- struct list match_os;
- struct list match_pnpid;
- struct list match_usbid;
- struct list match_driver;
- struct list match_tag;
- xf86TriState is_keyboard;
- xf86TriState is_pointer;
- xf86TriState is_joystick;
- xf86TriState is_tablet;
- xf86TriState is_touchpad;
- xf86TriState is_touchscreen;
- XF86OptionPtr option_lst;
- char *comment;
-}
-XF86ConfInputClassRec, *XF86ConfInputClassPtr;
-
-/* Values for adj_where */
-#define CONF_ADJ_OBSOLETE -1
-#define CONF_ADJ_ABSOLUTE 0
-#define CONF_ADJ_RIGHTOF 1
-#define CONF_ADJ_LEFTOF 2
-#define CONF_ADJ_ABOVE 3
-#define CONF_ADJ_BELOW 4
-#define CONF_ADJ_RELATIVE 5
-
-typedef struct
-{
- GenericListRec list;
- int adj_scrnum;
- XF86ConfScreenPtr adj_screen;
- char *adj_screen_str;
- XF86ConfScreenPtr adj_top;
- char *adj_top_str;
- XF86ConfScreenPtr adj_bottom;
- char *adj_bottom_str;
- XF86ConfScreenPtr adj_left;
- char *adj_left_str;
- XF86ConfScreenPtr adj_right;
- char *adj_right_str;
- int adj_where;
- int adj_x;
- int adj_y;
- char *adj_refscreen;
-}
-XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *inactive_device_str;
- XF86ConfDevicePtr inactive_device;
-}
-XF86ConfInactiveRec, *XF86ConfInactivePtr;
-
-typedef struct
-{
- GenericListRec list;
- char *lay_identifier;
- XF86ConfAdjacencyPtr lay_adjacency_lst;
- XF86ConfInactivePtr lay_inactive_lst;
- XF86ConfInputrefPtr lay_input_lst;
- XF86OptionPtr lay_option_lst;
- char *lay_comment;
-}
-XF86ConfLayoutRec, *XF86ConfLayoutPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *vs_name;
- char *vs_identifier;
- XF86OptionPtr vs_option_lst;
- char *vs_comment;
-}
-XF86ConfVendSubRec, *XF86ConfVendSubPtr;
-
-typedef struct
-{
- GenericListRec list;
- char *vnd_identifier;
- XF86OptionPtr vnd_option_lst;
- XF86ConfVendSubPtr vnd_sub_lst;
- char *vnd_comment;
-}
-XF86ConfVendorRec, *XF86ConfVendorPtr;
-
-typedef struct
-{
- char *dri_group_name;
- int dri_group;
- int dri_mode;
- char *dri_comment;
-}
-XF86ConfDRIRec, *XF86ConfDRIPtr;
-
-typedef struct
-{
- XF86OptionPtr ext_option_lst;
- char *extensions_comment;
-}
-XF86ConfExtensionsRec, *XF86ConfExtensionsPtr;
-
-typedef struct
-{
- XF86ConfFilesPtr conf_files;
- XF86ConfModulePtr conf_modules;
- XF86ConfFlagsPtr conf_flags;
- XF86ConfVideoAdaptorPtr conf_videoadaptor_lst;
- XF86ConfModesPtr conf_modes_lst;
- XF86ConfMonitorPtr conf_monitor_lst;
- XF86ConfDevicePtr conf_device_lst;
- XF86ConfScreenPtr conf_screen_lst;
- XF86ConfInputPtr conf_input_lst;
- XF86ConfInputClassPtr conf_inputclass_lst;
- XF86ConfLayoutPtr conf_layout_lst;
- XF86ConfVendorPtr conf_vendor_lst;
- XF86ConfDRIPtr conf_dri;
- XF86ConfExtensionsPtr conf_extensions;
- char *conf_comment;
-}
-XF86ConfigRec, *XF86ConfigPtr;
-
-typedef struct
-{
- int token; /* id of the token */
- char *name; /* pointer to the LOWERCASED name */
-}
-xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
-
-/*
- * prototypes for public functions
- */
-extern void xf86initConfigFiles(void);
-extern const char *xf86openConfigFile(const char *path, const char *cmdline,
- const char *projroot);
-extern const char *xf86openConfigDirFiles(const char *path, const char *cmdline,
- const char *projroot);
-extern void xf86setBuiltinConfig(const char *config[]);
-extern XF86ConfigPtr xf86readConfigFile(void);
-extern void xf86closeConfigFile(void);
-extern void xf86freeConfig(XF86ConfigPtr p);
-extern int xf86writeConfigFile(const char *, XF86ConfigPtr);
-extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p);
-extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list);
-extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p);
-extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p);
-extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p);
-extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p);
-extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p);
-extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p);
-extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident,
- XF86ConfVideoAdaptorPtr p);
-extern int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout);
-
-extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new);
-extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2);
-
-extern _X_EXPORT int xf86pathIsAbsolute(const char *path);
-extern _X_EXPORT int xf86pathIsSafe(const char *path);
-extern _X_EXPORT char *xf86addComment(char *cur, char *add);
-extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str);
-
-#endif /* _xf86Parser_h_ */
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+/*
+ * This file contains the external interfaces for the XFree86 configuration
+ * file parser.
+ */
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _xf86Parser_h_
+#define _xf86Parser_h_
+
+#include <X11/Xdefs.h>
+#include "xf86Optrec.h"
+#include "list.h"
+
+#define HAVE_PARSER_DECLS
+
+typedef struct
+{
+ char *file_logfile;
+ char *file_modulepath;
+ char *file_fontpath;
+ char *file_comment;
+ char *file_xkbdir;
+}
+XF86ConfFilesRec, *XF86ConfFilesPtr;
+
+/* Values for load_type */
+#define XF86_LOAD_MODULE 0
+#define XF86_LOAD_DRIVER 1
+#define XF86_DISABLE_MODULE 2
+
+typedef struct
+{
+ GenericListRec list;
+ int load_type;
+ char *load_name;
+ XF86OptionPtr load_opt;
+ char *load_comment;
+ int ignore;
+}
+XF86LoadRec, *XF86LoadPtr;
+
+typedef struct
+{
+ XF86LoadPtr mod_load_lst;
+ XF86LoadPtr mod_disable_lst;
+ char *mod_comment;
+}
+XF86ConfModuleRec, *XF86ConfModulePtr;
+
+#define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard"
+
+#define CONF_IMPLICIT_POINTER "Implicit Core Pointer"
+
+#define XF86CONF_PHSYNC 0x0001
+#define XF86CONF_NHSYNC 0x0002
+#define XF86CONF_PVSYNC 0x0004
+#define XF86CONF_NVSYNC 0x0008
+#define XF86CONF_INTERLACE 0x0010
+#define XF86CONF_DBLSCAN 0x0020
+#define XF86CONF_CSYNC 0x0040
+#define XF86CONF_PCSYNC 0x0080
+#define XF86CONF_NCSYNC 0x0100
+#define XF86CONF_HSKEW 0x0200 /* hskew provided */
+#define XF86CONF_BCAST 0x0400
+#define XF86CONF_VSCAN 0x1000
+
+typedef struct
+{
+ GenericListRec list;
+ char *ml_identifier;
+ int ml_clock;
+ int ml_hdisplay;
+ int ml_hsyncstart;
+ int ml_hsyncend;
+ int ml_htotal;
+ int ml_vdisplay;
+ int ml_vsyncstart;
+ int ml_vsyncend;
+ int ml_vtotal;
+ int ml_vscan;
+ int ml_flags;
+ int ml_hskew;
+ char *ml_comment;
+}
+XF86ConfModeLineRec, *XF86ConfModeLinePtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *vp_identifier;
+ XF86OptionPtr vp_option_lst;
+ char *vp_comment;
+}
+XF86ConfVideoPortRec, *XF86ConfVideoPortPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *va_identifier;
+ char *va_vendor;
+ char *va_board;
+ char *va_busid;
+ char *va_driver;
+ XF86OptionPtr va_option_lst;
+ XF86ConfVideoPortPtr va_port_lst;
+ char *va_fwdref;
+ char *va_comment;
+}
+XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr;
+
+#define CONF_MAX_HSYNC 8
+#define CONF_MAX_VREFRESH 8
+
+typedef struct
+{
+ float hi, lo;
+}
+parser_range;
+
+typedef struct
+{
+ int red, green, blue;
+}
+parser_rgb;
+
+typedef struct
+{
+ GenericListRec list;
+ char *modes_identifier;
+ XF86ConfModeLinePtr mon_modeline_lst;
+ char *modes_comment;
+}
+XF86ConfModesRec, *XF86ConfModesPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *ml_modes_str;
+ XF86ConfModesPtr ml_modes;
+}
+XF86ConfModesLinkRec, *XF86ConfModesLinkPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *mon_identifier;
+ char *mon_vendor;
+ char *mon_modelname;
+ int mon_width; /* in mm */
+ int mon_height; /* in mm */
+ XF86ConfModeLinePtr mon_modeline_lst;
+ int mon_n_hsync;
+ parser_range mon_hsync[CONF_MAX_HSYNC];
+ int mon_n_vrefresh;
+ parser_range mon_vrefresh[CONF_MAX_VREFRESH];
+ float mon_gamma_red;
+ float mon_gamma_green;
+ float mon_gamma_blue;
+ XF86OptionPtr mon_option_lst;
+ XF86ConfModesLinkPtr mon_modes_sect_lst;
+ char *mon_comment;
+}
+XF86ConfMonitorRec, *XF86ConfMonitorPtr;
+
+#define CONF_MAXDACSPEEDS 4
+#define CONF_MAXCLOCKS 128
+
+typedef struct
+{
+ GenericListRec list;
+ char *dev_identifier;
+ char *dev_vendor;
+ char *dev_board;
+ char *dev_chipset;
+ char *dev_busid;
+ char *dev_card;
+ char *dev_driver;
+ char *dev_ramdac;
+ int dev_dacSpeeds[CONF_MAXDACSPEEDS];
+ int dev_videoram;
+ int dev_textclockfreq;
+ unsigned long dev_bios_base;
+ unsigned long dev_mem_base;
+ unsigned long dev_io_base;
+ char *dev_clockchip;
+ int dev_clocks;
+ int dev_clock[CONF_MAXCLOCKS];
+ int dev_chipid;
+ int dev_chiprev;
+ int dev_irq;
+ int dev_screen;
+ XF86OptionPtr dev_option_lst;
+ char *dev_comment;
+}
+XF86ConfDeviceRec, *XF86ConfDevicePtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *mode_name;
+}
+XF86ModeRec, *XF86ModePtr;
+
+typedef struct
+{
+ GenericListRec list;
+ int disp_frameX0;
+ int disp_frameY0;
+ int disp_virtualX;
+ int disp_virtualY;
+ int disp_depth;
+ int disp_bpp;
+ char *disp_visual;
+ parser_rgb disp_weight;
+ parser_rgb disp_black;
+ parser_rgb disp_white;
+ XF86ModePtr disp_mode_lst;
+ XF86OptionPtr disp_option_lst;
+ char *disp_comment;
+}
+XF86ConfDisplayRec, *XF86ConfDisplayPtr;
+
+typedef struct
+{
+ XF86OptionPtr flg_option_lst;
+ char *flg_comment;
+}
+XF86ConfFlagsRec, *XF86ConfFlagsPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *al_adaptor_str;
+ XF86ConfVideoAdaptorPtr al_adaptor;
+}
+XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *scrn_identifier;
+ char *scrn_obso_driver;
+ int scrn_defaultdepth;
+ int scrn_defaultbpp;
+ int scrn_defaultfbbpp;
+ char *scrn_monitor_str;
+ XF86ConfMonitorPtr scrn_monitor;
+ char *scrn_device_str;
+ XF86ConfDevicePtr scrn_device;
+ XF86ConfAdaptorLinkPtr scrn_adaptor_lst;
+ XF86ConfDisplayPtr scrn_display_lst;
+ XF86OptionPtr scrn_option_lst;
+ char *scrn_comment;
+ int scrn_virtualX, scrn_virtualY;
+}
+XF86ConfScreenRec, *XF86ConfScreenPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *inp_identifier;
+ char *inp_driver;
+ XF86OptionPtr inp_option_lst;
+ char *inp_comment;
+}
+XF86ConfInputRec, *XF86ConfInputPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ XF86ConfInputPtr iref_inputdev;
+ char *iref_inputdev_str;
+ XF86OptionPtr iref_option_lst;
+}
+XF86ConfInputrefRec, *XF86ConfInputrefPtr;
+
+typedef struct
+{
+ Bool set;
+ Bool val;
+}
+xf86TriState;
+
+typedef struct
+{
+ struct list entry;
+ char **values;
+}
+xf86MatchGroup;
+
+typedef struct
+{
+ GenericListRec list;
+ char *identifier;
+ char *driver;
+ struct list match_product;
+ struct list match_vendor;
+ struct list match_device;
+ struct list match_os;
+ struct list match_pnpid;
+ struct list match_usbid;
+ struct list match_driver;
+ struct list match_tag;
+ struct list match_layout;
+ xf86TriState is_keyboard;
+ xf86TriState is_pointer;
+ xf86TriState is_joystick;
+ xf86TriState is_tablet;
+ xf86TriState is_touchpad;
+ xf86TriState is_touchscreen;
+ XF86OptionPtr option_lst;
+ char *comment;
+}
+XF86ConfInputClassRec, *XF86ConfInputClassPtr;
+
+/* Values for adj_where */
+#define CONF_ADJ_OBSOLETE -1
+#define CONF_ADJ_ABSOLUTE 0
+#define CONF_ADJ_RIGHTOF 1
+#define CONF_ADJ_LEFTOF 2
+#define CONF_ADJ_ABOVE 3
+#define CONF_ADJ_BELOW 4
+#define CONF_ADJ_RELATIVE 5
+
+typedef struct
+{
+ GenericListRec list;
+ int adj_scrnum;
+ XF86ConfScreenPtr adj_screen;
+ char *adj_screen_str;
+ XF86ConfScreenPtr adj_top;
+ char *adj_top_str;
+ XF86ConfScreenPtr adj_bottom;
+ char *adj_bottom_str;
+ XF86ConfScreenPtr adj_left;
+ char *adj_left_str;
+ XF86ConfScreenPtr adj_right;
+ char *adj_right_str;
+ int adj_where;
+ int adj_x;
+ int adj_y;
+ char *adj_refscreen;
+}
+XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *inactive_device_str;
+ XF86ConfDevicePtr inactive_device;
+}
+XF86ConfInactiveRec, *XF86ConfInactivePtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *lay_identifier;
+ XF86ConfAdjacencyPtr lay_adjacency_lst;
+ XF86ConfInactivePtr lay_inactive_lst;
+ XF86ConfInputrefPtr lay_input_lst;
+ XF86OptionPtr lay_option_lst;
+ char *lay_comment;
+}
+XF86ConfLayoutRec, *XF86ConfLayoutPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *vs_name;
+ char *vs_identifier;
+ XF86OptionPtr vs_option_lst;
+ char *vs_comment;
+}
+XF86ConfVendSubRec, *XF86ConfVendSubPtr;
+
+typedef struct
+{
+ GenericListRec list;
+ char *vnd_identifier;
+ XF86OptionPtr vnd_option_lst;
+ XF86ConfVendSubPtr vnd_sub_lst;
+ char *vnd_comment;
+}
+XF86ConfVendorRec, *XF86ConfVendorPtr;
+
+typedef struct
+{
+ char *dri_group_name;
+ int dri_group;
+ int dri_mode;
+ char *dri_comment;
+}
+XF86ConfDRIRec, *XF86ConfDRIPtr;
+
+typedef struct
+{
+ XF86OptionPtr ext_option_lst;
+ char *extensions_comment;
+}
+XF86ConfExtensionsRec, *XF86ConfExtensionsPtr;
+
+typedef struct
+{
+ XF86ConfFilesPtr conf_files;
+ XF86ConfModulePtr conf_modules;
+ XF86ConfFlagsPtr conf_flags;
+ XF86ConfVideoAdaptorPtr conf_videoadaptor_lst;
+ XF86ConfModesPtr conf_modes_lst;
+ XF86ConfMonitorPtr conf_monitor_lst;
+ XF86ConfDevicePtr conf_device_lst;
+ XF86ConfScreenPtr conf_screen_lst;
+ XF86ConfInputPtr conf_input_lst;
+ XF86ConfInputClassPtr conf_inputclass_lst;
+ XF86ConfLayoutPtr conf_layout_lst;
+ XF86ConfVendorPtr conf_vendor_lst;
+ XF86ConfDRIPtr conf_dri;
+ XF86ConfExtensionsPtr conf_extensions;
+ char *conf_comment;
+}
+XF86ConfigRec, *XF86ConfigPtr;
+
+typedef struct
+{
+ int token; /* id of the token */
+ char *name; /* pointer to the LOWERCASED name */
+}
+xf86ConfigSymTabRec, *xf86ConfigSymTabPtr;
+
+/*
+ * prototypes for public functions
+ */
+extern void xf86initConfigFiles(void);
+extern const char *xf86openConfigFile(const char *path, const char *cmdline,
+ const char *projroot);
+extern const char *xf86openConfigDirFiles(const char *path, const char *cmdline,
+ const char *projroot);
+extern void xf86setBuiltinConfig(const char *config[]);
+extern XF86ConfigPtr xf86readConfigFile(void);
+extern void xf86closeConfigFile(void);
+extern void xf86freeConfig(XF86ConfigPtr p);
+extern int xf86writeConfigFile(const char *, XF86ConfigPtr);
+extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p);
+extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list);
+extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p);
+extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p);
+extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p);
+extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p);
+extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p);
+extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p);
+extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident,
+ XF86ConfVideoAdaptorPtr p);
+extern int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout);
+
+extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new);
+extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2);
+
+extern _X_EXPORT int xf86pathIsAbsolute(const char *path);
+extern _X_EXPORT int xf86pathIsSafe(const char *path);
+extern _X_EXPORT char *xf86addComment(char *cur, char *add);
+extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str);
+
+#endif /* _xf86Parser_h_ */
diff --git a/xorg-server/hw/xfree86/parser/xf86tokens.h b/xorg-server/hw/xfree86/parser/xf86tokens.h
index d91755d7e..abcafcf8e 100644
--- a/xorg-server/hw/xfree86/parser/xf86tokens.h
+++ b/xorg-server/hw/xfree86/parser/xf86tokens.h
@@ -1,293 +1,294 @@
-/*
- *
- * Copyright (c) 1997 Metro Link Incorporated
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
- * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- *
- * Except as contained in this notice, the name of the Metro Link shall not be
- * used in advertising or otherwise to promote the sale, use or other dealings
- * in this Software without prior written authorization from Metro Link.
- *
- */
-/*
- * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name of the copyright holder(s)
- * and author(s) shall not be used in advertising or otherwise to promote
- * the sale, use or other dealings in this Software without prior written
- * authorization from the copyright holder(s) and author(s).
- */
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#ifndef _xf86_tokens_h
-#define _xf86_tokens_h
-
-/* Undefine symbols that some OSs might define */
-#undef IOBASE
-
-/*
- * Each token should have a unique value regardless of the section
- * it is used in.
- */
-
-typedef enum {
- /* errno-style tokens */
- OBSOLETE_TOKEN = -5,
- EOF_TOKEN = -4,
- LOCK_TOKEN = -3,
- ERROR_TOKEN = -2,
-
- /* value type tokens */
- NUMBER = 1,
- STRING,
-
- /* Tokens that can appear in many sections */
- SECTION,
- SUBSECTION,
- ENDSECTION,
- ENDSUBSECTION,
- IDENTIFIER,
- VENDOR,
- DASH,
- COMMA,
- OPTION,
- COMMENT,
-
- /* Frequency units */
- HRZ,
- KHZ,
- MHZ,
-
- /* File tokens */
- FONTPATH,
- MODULEPATH,
- LOGFILEPATH,
- XKBDIR,
-
- /* Server Flag tokens. These are deprecated in favour of generic Options */
- NOTRAPSIGNALS,
- DONTZAP,
- DONTZOOM,
- DISABLEVIDMODE,
- ALLOWNONLOCAL,
- DISABLEMODINDEV,
- MODINDEVALLOWNONLOCAL,
- ALLOWMOUSEOPENFAIL,
- BLANKTIME,
- STANDBYTIME,
- SUSPENDTIME,
- OFFTIME,
- DEFAULTLAYOUT,
-
- /* Monitor tokens */
- MODEL,
- MODELINE,
- DISPLAYSIZE,
- HORIZSYNC,
- VERTREFRESH,
- MODE,
- GAMMA,
- USEMODES,
-
- /* Modes tokens */
- /* no new ones */
-
- /* Mode tokens */
- DOTCLOCK,
- HTIMINGS,
- VTIMINGS,
- FLAGS,
- HSKEW,
- BCAST,
- VSCAN,
- ENDMODE,
-
- /* Screen tokens */
- OBSDRIVER,
- MDEVICE,
- MONITOR,
- SCREENNO,
- DEFAULTDEPTH,
- DEFAULTBPP,
- DEFAULTFBBPP,
-
- /* VideoAdaptor tokens */
- VIDEOADAPTOR,
-
- /* Mode timing tokens */
- TT_INTERLACE,
- TT_PHSYNC,
- TT_NHSYNC,
- TT_PVSYNC,
- TT_NVSYNC,
- TT_CSYNC,
- TT_PCSYNC,
- TT_NCSYNC,
- TT_DBLSCAN,
- TT_HSKEW,
- TT_BCAST,
- TT_VSCAN,
-
- /* Module tokens */
- LOAD,
- LOAD_DRIVER,
- DISABLE,
-
- /* Device tokens */
- DRIVER,
- CHIPSET,
- CLOCKS,
- VIDEORAM,
- BOARD,
- IOBASE,
- RAMDAC,
- DACSPEED,
- BIOSBASE,
- MEMBASE,
- CLOCKCHIP,
- CHIPID,
- CHIPREV,
- CARD,
- BUSID,
- TEXTCLOCKFRQ,
- IRQ,
-
- /* Keyboard tokens */
- AUTOREPEAT,
- XLEDS,
- KPROTOCOL,
- XKBKEYMAP,
- XKBCOMPAT,
- XKBTYPES,
- XKBKEYCODES,
- XKBGEOMETRY,
- XKBSYMBOLS,
- XKBDISABLE,
- PANIX106,
- XKBRULES,
- XKBMODEL,
- XKBLAYOUT,
- XKBVARIANT,
- XKBOPTIONS,
- /* The next two have become ServerFlags options */
- VTSYSREQ,
- /* Obsolete keyboard tokens */
- SERVERNUM,
- LEFTALT,
- RIGHTALT,
- SCROLLLOCK_TOK,
- RIGHTCTL,
- /* arguments for the above obsolete tokens */
- CONF_KM_META,
- CONF_KM_COMPOSE,
- CONF_KM_MODESHIFT,
- CONF_KM_MODELOCK,
- CONF_KM_SCROLLLOCK,
- CONF_KM_CONTROL,
-
- /* Pointer tokens */
- EMULATE3,
- BAUDRATE,
- SAMPLERATE,
- PRESOLUTION,
- CLEARDTR,
- CLEARRTS,
- CHORDMIDDLE,
- PROTOCOL,
- PDEVICE,
- EM3TIMEOUT,
- DEVICE_NAME,
- ALWAYSCORE,
- PBUTTONS,
- ZAXISMAPPING,
-
- /* Pointer Z axis mapping tokens */
- XAXIS,
- YAXIS,
-
- /* Display tokens */
- MODES,
- VIEWPORT,
- VIRTUAL,
- VISUAL,
- BLACK_TOK,
- WHITE_TOK,
- DEPTH,
- BPP,
- WEIGHT,
-
- /* Layout Tokens */
- SCREEN,
- INACTIVE,
- INPUTDEVICE,
-
- /* Adjaceny Tokens */
- RIGHTOF,
- LEFTOF,
- ABOVE,
- BELOW,
- RELATIVE,
- ABSOLUTE,
-
- /* Vendor Tokens */
- VENDORNAME,
-
- /* DRI Tokens */
- GROUP,
-
- /* InputClass Tokens */
- MATCH_PRODUCT,
- MATCH_VENDOR,
- MATCH_DEVICE_PATH,
- MATCH_OS,
- MATCH_PNPID,
- MATCH_USBID,
- MATCH_DRIVER,
- MATCH_TAG,
- MATCH_IS_KEYBOARD,
- MATCH_IS_POINTER,
- MATCH_IS_JOYSTICK,
- MATCH_IS_TABLET,
- MATCH_IS_TOUCHPAD,
- MATCH_IS_TOUCHSCREEN
-} ParserTokens;
-
-#endif /* _xf86_tokens_h */
+/*
+ *
+ * Copyright (c) 1997 Metro Link Incorporated
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+ * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the Metro Link shall not be
+ * used in advertising or otherwise to promote the sale, use or other dealings
+ * in this Software without prior written authorization from Metro Link.
+ *
+ */
+/*
+ * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name of the copyright holder(s)
+ * and author(s) shall not be used in advertising or otherwise to promote
+ * the sale, use or other dealings in this Software without prior written
+ * authorization from the copyright holder(s) and author(s).
+ */
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#ifndef _xf86_tokens_h
+#define _xf86_tokens_h
+
+/* Undefine symbols that some OSs might define */
+#undef IOBASE
+
+/*
+ * Each token should have a unique value regardless of the section
+ * it is used in.
+ */
+
+typedef enum {
+ /* errno-style tokens */
+ OBSOLETE_TOKEN = -5,
+ EOF_TOKEN = -4,
+ LOCK_TOKEN = -3,
+ ERROR_TOKEN = -2,
+
+ /* value type tokens */
+ NUMBER = 1,
+ STRING,
+
+ /* Tokens that can appear in many sections */
+ SECTION,
+ SUBSECTION,
+ ENDSECTION,
+ ENDSUBSECTION,
+ IDENTIFIER,
+ VENDOR,
+ DASH,
+ COMMA,
+ OPTION,
+ COMMENT,
+
+ /* Frequency units */
+ HRZ,
+ KHZ,
+ MHZ,
+
+ /* File tokens */
+ FONTPATH,
+ MODULEPATH,
+ LOGFILEPATH,
+ XKBDIR,
+
+ /* Server Flag tokens. These are deprecated in favour of generic Options */
+ NOTRAPSIGNALS,
+ DONTZAP,
+ DONTZOOM,
+ DISABLEVIDMODE,
+ ALLOWNONLOCAL,
+ DISABLEMODINDEV,
+ MODINDEVALLOWNONLOCAL,
+ ALLOWMOUSEOPENFAIL,
+ BLANKTIME,
+ STANDBYTIME,
+ SUSPENDTIME,
+ OFFTIME,
+ DEFAULTLAYOUT,
+
+ /* Monitor tokens */
+ MODEL,
+ MODELINE,
+ DISPLAYSIZE,
+ HORIZSYNC,
+ VERTREFRESH,
+ MODE,
+ GAMMA,
+ USEMODES,
+
+ /* Modes tokens */
+ /* no new ones */
+
+ /* Mode tokens */
+ DOTCLOCK,
+ HTIMINGS,
+ VTIMINGS,
+ FLAGS,
+ HSKEW,
+ BCAST,
+ VSCAN,
+ ENDMODE,
+
+ /* Screen tokens */
+ OBSDRIVER,
+ MDEVICE,
+ MONITOR,
+ SCREENNO,
+ DEFAULTDEPTH,
+ DEFAULTBPP,
+ DEFAULTFBBPP,
+
+ /* VideoAdaptor tokens */
+ VIDEOADAPTOR,
+
+ /* Mode timing tokens */
+ TT_INTERLACE,
+ TT_PHSYNC,
+ TT_NHSYNC,
+ TT_PVSYNC,
+ TT_NVSYNC,
+ TT_CSYNC,
+ TT_PCSYNC,
+ TT_NCSYNC,
+ TT_DBLSCAN,
+ TT_HSKEW,
+ TT_BCAST,
+ TT_VSCAN,
+
+ /* Module tokens */
+ LOAD,
+ LOAD_DRIVER,
+ DISABLE,
+
+ /* Device tokens */
+ DRIVER,
+ CHIPSET,
+ CLOCKS,
+ VIDEORAM,
+ BOARD,
+ IOBASE,
+ RAMDAC,
+ DACSPEED,
+ BIOSBASE,
+ MEMBASE,
+ CLOCKCHIP,
+ CHIPID,
+ CHIPREV,
+ CARD,
+ BUSID,
+ TEXTCLOCKFRQ,
+ IRQ,
+
+ /* Keyboard tokens */
+ AUTOREPEAT,
+ XLEDS,
+ KPROTOCOL,
+ XKBKEYMAP,
+ XKBCOMPAT,
+ XKBTYPES,
+ XKBKEYCODES,
+ XKBGEOMETRY,
+ XKBSYMBOLS,
+ XKBDISABLE,
+ PANIX106,
+ XKBRULES,
+ XKBMODEL,
+ XKBLAYOUT,
+ XKBVARIANT,
+ XKBOPTIONS,
+ /* The next two have become ServerFlags options */
+ VTSYSREQ,
+ /* Obsolete keyboard tokens */
+ SERVERNUM,
+ LEFTALT,
+ RIGHTALT,
+ SCROLLLOCK_TOK,
+ RIGHTCTL,
+ /* arguments for the above obsolete tokens */
+ CONF_KM_META,
+ CONF_KM_COMPOSE,
+ CONF_KM_MODESHIFT,
+ CONF_KM_MODELOCK,
+ CONF_KM_SCROLLLOCK,
+ CONF_KM_CONTROL,
+
+ /* Pointer tokens */
+ EMULATE3,
+ BAUDRATE,
+ SAMPLERATE,
+ PRESOLUTION,
+ CLEARDTR,
+ CLEARRTS,
+ CHORDMIDDLE,
+ PROTOCOL,
+ PDEVICE,
+ EM3TIMEOUT,
+ DEVICE_NAME,
+ ALWAYSCORE,
+ PBUTTONS,
+ ZAXISMAPPING,
+
+ /* Pointer Z axis mapping tokens */
+ XAXIS,
+ YAXIS,
+
+ /* Display tokens */
+ MODES,
+ VIEWPORT,
+ VIRTUAL,
+ VISUAL,
+ BLACK_TOK,
+ WHITE_TOK,
+ DEPTH,
+ BPP,
+ WEIGHT,
+
+ /* Layout Tokens */
+ SCREEN,
+ INACTIVE,
+ INPUTDEVICE,
+
+ /* Adjaceny Tokens */
+ RIGHTOF,
+ LEFTOF,
+ ABOVE,
+ BELOW,
+ RELATIVE,
+ ABSOLUTE,
+
+ /* Vendor Tokens */
+ VENDORNAME,
+
+ /* DRI Tokens */
+ GROUP,
+
+ /* InputClass Tokens */
+ MATCH_PRODUCT,
+ MATCH_VENDOR,
+ MATCH_DEVICE_PATH,
+ MATCH_OS,
+ MATCH_PNPID,
+ MATCH_USBID,
+ MATCH_DRIVER,
+ MATCH_TAG,
+ MATCH_LAYOUT,
+ MATCH_IS_KEYBOARD,
+ MATCH_IS_POINTER,
+ MATCH_IS_JOYSTICK,
+ MATCH_IS_TABLET,
+ MATCH_IS_TOUCHPAD,
+ MATCH_IS_TOUCHSCREEN
+} ParserTokens;
+
+#endif /* _xf86_tokens_h */
diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c
index 255015a24..2cd8caff1 100644
--- a/xorg-server/hw/xwin/winkeybd.c
+++ b/xorg-server/hw/xwin/winkeybd.c
@@ -487,8 +487,6 @@ winKeybdReleaseKeys (void)
void
winSendKeyEvent (DWORD dwKey, Bool fDown)
{
- InternalEvent* events;
-
/*
* When alt-tabing between screens we can get phantom key up messages
* Here we only pass them through it we think we should!
diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c
index efe71103c..6d2e43f07 100644
--- a/xorg-server/hw/xwin/winmouse.c
+++ b/xorg-server/hw/xwin/winmouse.c
@@ -250,7 +250,12 @@ winMouseButtonsSendEvent (int iEventType, int iButton)
QueuePointerEvents(g_pwinPointer, iEventType, iButton,
POINTER_RELATIVE, &mask);
+#if CYGDEBUG
+ ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d, nEvents %d\n",
+ iEventType, iButton, nevents);
winDebug("winMouseButtonsSendEvent: iEventType: %d, iButton: %d\n",
+#if CYGDEBUG
+ ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d\n",
iEventType, iButton);
}
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index 13f4ba98e..c44cee638 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -305,12 +305,6 @@ extern _X_EXPORT Bool InitPointerAccelerationScheme(
DeviceIntPtr /*dev*/,
int /*scheme*/);
-/**
- * This is not implemented and just returns FALSE.
- */
-extern _X_EXPORT _X_DEPRECATED Bool InitAbsoluteClassDeviceStruct(
- DeviceIntPtr /*device*/);
-
extern _X_EXPORT Bool InitFocusClassDeviceStruct(
DeviceIntPtr /*device*/);
diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h
index ecbc6e09e..a536a6a5a 100644
--- a/xorg-server/include/inputstr.h
+++ b/xorg-server/include/inputstr.h
@@ -371,7 +371,6 @@ typedef struct _ClassesRec {
ButtonClassPtr button;
FocusClassPtr focus;
ProximityClassPtr proximity;
- void* _pad0; /* keep ABI during AbsoluteClass removal */
KbdFeedbackPtr kbdfeed;
PtrFeedbackPtr ptrfeed;
IntegerFeedbackPtr intfeed;
@@ -496,7 +495,6 @@ typedef struct _DeviceIntRec {
ButtonClassPtr button;
FocusClassPtr focus;
ProximityClassPtr proximity;
- void* _pad0; /* keep ABI, was pointer to abs class */
KbdFeedbackPtr kbdfeed;
PtrFeedbackPtr ptrfeed;
IntegerFeedbackPtr intfeed;
diff --git a/xorg-server/include/xserver-properties.h b/xorg-server/include/xserver-properties.h
index d3dc976fd..2b1feabb6 100644
--- a/xorg-server/include/xserver-properties.h
+++ b/xorg-server/include/xserver-properties.h
@@ -1,191 +1,199 @@
-/*
- * Copyright 2008 Red Hat, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software")
- * to deal in the software without restriction, including without limitation
- * on the rights to use, copy, modify, merge, publish, distribute, sub
- * license, and/or sell copies of the Software, and to permit persons to whom
- * them Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
- * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-
-/* Properties managed by the server. */
-
-#ifndef _XSERVER_PROPERTIES_H_
-#define _XSERVER_PROPERTIES_H_
-
-/* Type for a 4 byte float. Storage format IEEE 754 in client's default
- * byte-ordering. */
-#define XATOM_FLOAT "FLOAT"
-
-/* BOOL. 0 - device disabled, 1 - device enabled */
-#define XI_PROP_ENABLED "Device Enabled"
-/* BOOL. If present, device is a virtual XTEST device */
-#define XI_PROP_XTEST_DEVICE "XTEST Device"
-
-/* Coordinate transformation matrix for absolute input devices
- * FLOAT, 9 values in row-major order, coordinates in 0..1 range:
- * [c0 c1 c2] [x]
- * [c3 c4 c5] * [y]
- * [c6 c7 c8] [1] */
-#define XI_PROP_TRANSFORM "Coordinate Transformation Matrix"
-
-/* Pointer acceleration properties */
-/* INTEGER of any format */
-#define ACCEL_PROP_PROFILE_NUMBER "Device Accel Profile"
-/* FLOAT, format 32 */
-#define ACCEL_PROP_CONSTANT_DECELERATION "Device Accel Constant Deceleration"
-/* FLOAT, format 32 */
-#define ACCEL_PROP_ADAPTIVE_DECELERATION "Device Accel Adaptive Deceleration"
-/* FLOAT, format 32 */
-#define ACCEL_PROP_VELOCITY_SCALING "Device Accel Velocity Scaling"
-
-
-/* Axis labels */
-#define AXIS_LABEL_PROP "Axis Labels"
-
-#define AXIS_LABEL_PROP_REL_X "Rel X"
-#define AXIS_LABEL_PROP_REL_Y "Rel Y"
-#define AXIS_LABEL_PROP_REL_Z "Rel Z"
-#define AXIS_LABEL_PROP_REL_RX "Rel Rotary X"
-#define AXIS_LABEL_PROP_REL_RY "Rel Rotary Y"
-#define AXIS_LABEL_PROP_REL_RZ "Rel Rotary Z"
-#define AXIS_LABEL_PROP_REL_HWHEEL "Rel Horiz Wheel"
-#define AXIS_LABEL_PROP_REL_DIAL "Rel Dial"
-#define AXIS_LABEL_PROP_REL_WHEEL "Rel Vert Wheel"
-#define AXIS_LABEL_PROP_REL_MISC "Rel Misc"
-
-/*
- * Absolute axes
- */
-
-#define AXIS_LABEL_PROP_ABS_X "Abs X"
-#define AXIS_LABEL_PROP_ABS_Y "Abs Y"
-#define AXIS_LABEL_PROP_ABS_Z "Abs Z"
-#define AXIS_LABEL_PROP_ABS_RX "Abs Rotary X"
-#define AXIS_LABEL_PROP_ABS_RY "Abs Rotary Y"
-#define AXIS_LABEL_PROP_ABS_RZ "Abs Rotary Z"
-#define AXIS_LABEL_PROP_ABS_THROTTLE "Abs Throttle"
-#define AXIS_LABEL_PROP_ABS_RUDDER "Abs Rudder"
-#define AXIS_LABEL_PROP_ABS_WHEEL "Abs Wheel"
-#define AXIS_LABEL_PROP_ABS_GAS "Abs Gas"
-#define AXIS_LABEL_PROP_ABS_BRAKE "Abs Brake"
-#define AXIS_LABEL_PROP_ABS_HAT0X "Abs Hat 0 X"
-#define AXIS_LABEL_PROP_ABS_HAT0Y "Abs Hat 0 Y"
-#define AXIS_LABEL_PROP_ABS_HAT1X "Abs Hat 1 X"
-#define AXIS_LABEL_PROP_ABS_HAT1Y "Abs Hat 1 Y"
-#define AXIS_LABEL_PROP_ABS_HAT2X "Abs Hat 2 X"
-#define AXIS_LABEL_PROP_ABS_HAT2Y "Abs Hat 2 Y"
-#define AXIS_LABEL_PROP_ABS_HAT3X "Abs Hat 3 X"
-#define AXIS_LABEL_PROP_ABS_HAT3Y "Abs Hat 3 Y"
-#define AXIS_LABEL_PROP_ABS_PRESSURE "Abs Pressure"
-#define AXIS_LABEL_PROP_ABS_DISTANCE "Abs Distance"
-#define AXIS_LABEL_PROP_ABS_TILT_X "Abs Tilt X"
-#define AXIS_LABEL_PROP_ABS_TILT_Y "Abs Tilt Y"
-#define AXIS_LABEL_PROP_ABS_TOOL_WIDTH "Abs Tool Width"
-#define AXIS_LABEL_PROP_ABS_VOLUME "Abs Volume"
-#define AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR "Abs MT Touch Major"
-#define AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR "Abs MT Touch Minor"
-#define AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR "Abs MT Width Major"
-#define AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR "Abs MT Width Minor"
-#define AXIS_LABEL_PROP_ABS_MT_ORIENTATION "Abs MT Orientation"
-#define AXIS_LABEL_PROP_ABS_MT_POSITION_X "Abs MT Position X"
-#define AXIS_LABEL_PROP_ABS_MT_POSITION_Y "Abs MT Position Y"
-#define AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE "Abs MT Tool Type"
-#define AXIS_LABEL_PROP_ABS_MT_BLOB_ID "Abs MT Blob ID"
-#define AXIS_LABEL_PROP_ABS_MT_TRACKING_ID "Abs MT Tracking ID"
-#define AXIS_LABEL_PROP_ABS_MT_PRESSURE "Abs MT Pressure"
-#define AXIS_LABEL_PROP_ABS_MISC "Abs Misc"
-
-/* Button names */
-#define BTN_LABEL_PROP "Button Labels"
-
-/* Default label */
-#define BTN_LABEL_PROP_BTN_UNKNOWN "Button Unknown"
-/* Wheel buttons */
-#define BTN_LABEL_PROP_BTN_WHEEL_UP "Button Wheel Up"
-#define BTN_LABEL_PROP_BTN_WHEEL_DOWN "Button Wheel Down"
-#define BTN_LABEL_PROP_BTN_HWHEEL_LEFT "Button Horiz Wheel Left"
-#define BTN_LABEL_PROP_BTN_HWHEEL_RIGHT "Button Horiz Wheel Right"
-
-/* The following are from linux/input.h */
-#define BTN_LABEL_PROP_BTN_0 "Button 0"
-#define BTN_LABEL_PROP_BTN_1 "Button 1"
-#define BTN_LABEL_PROP_BTN_2 "Button 2"
-#define BTN_LABEL_PROP_BTN_3 "Button 3"
-#define BTN_LABEL_PROP_BTN_4 "Button 4"
-#define BTN_LABEL_PROP_BTN_5 "Button 5"
-#define BTN_LABEL_PROP_BTN_6 "Button 6"
-#define BTN_LABEL_PROP_BTN_7 "Button 7"
-#define BTN_LABEL_PROP_BTN_8 "Button 8"
-#define BTN_LABEL_PROP_BTN_9 "Button 9"
-
-#define BTN_LABEL_PROP_BTN_LEFT "Button Left"
-#define BTN_LABEL_PROP_BTN_RIGHT "Button Right"
-#define BTN_LABEL_PROP_BTN_MIDDLE "Button Middle"
-#define BTN_LABEL_PROP_BTN_SIDE "Button Side"
-#define BTN_LABEL_PROP_BTN_EXTRA "Button Extra"
-#define BTN_LABEL_PROP_BTN_FORWARD "Button Forward"
-#define BTN_LABEL_PROP_BTN_BACK "Button Back"
-#define BTN_LABEL_PROP_BTN_TASK "Button Task"
-
-#define BTN_LABEL_PROP_BTN_TRIGGER "Button Trigger"
-#define BTN_LABEL_PROP_BTN_THUMB "Button Thumb"
-#define BTN_LABEL_PROP_BTN_THUMB2 "Button Thumb2"
-#define BTN_LABEL_PROP_BTN_TOP "Button Top"
-#define BTN_LABEL_PROP_BTN_TOP2 "Button Top2"
-#define BTN_LABEL_PROP_BTN_PINKIE "Button Pinkie"
-#define BTN_LABEL_PROP_BTN_BASE "Button Base"
-#define BTN_LABEL_PROP_BTN_BASE2 "Button Base2"
-#define BTN_LABEL_PROP_BTN_BASE3 "Button Base3"
-#define BTN_LABEL_PROP_BTN_BASE4 "Button Base4"
-#define BTN_LABEL_PROP_BTN_BASE5 "Button Base5"
-#define BTN_LABEL_PROP_BTN_BASE6 "Button Base6"
-#define BTN_LABEL_PROP_BTN_DEAD "Button Dead"
-
-#define BTN_LABEL_PROP_BTN_A "Button A"
-#define BTN_LABEL_PROP_BTN_B "Button B"
-#define BTN_LABEL_PROP_BTN_C "Button C"
-#define BTN_LABEL_PROP_BTN_X "Button X"
-#define BTN_LABEL_PROP_BTN_Y "Button Y"
-#define BTN_LABEL_PROP_BTN_Z "Button Z"
-#define BTN_LABEL_PROP_BTN_TL "Button T Left"
-#define BTN_LABEL_PROP_BTN_TR "Button T Right"
-#define BTN_LABEL_PROP_BTN_TL2 "Button T Left2"
-#define BTN_LABEL_PROP_BTN_TR2 "Button T Right2"
-#define BTN_LABEL_PROP_BTN_SELECT "Button Select"
-#define BTN_LABEL_PROP_BTN_START "Button Start"
-#define BTN_LABEL_PROP_BTN_MODE "Button Mode"
-#define BTN_LABEL_PROP_BTN_THUMBL "Button Thumb Left"
-#define BTN_LABEL_PROP_BTN_THUMBR "Button Thumb Right"
-
-#define BTN_LABEL_PROP_BTN_TOOL_PEN "Button Tool Pen"
-#define BTN_LABEL_PROP_BTN_TOOL_RUBBER "Button Tool Rubber"
-#define BTN_LABEL_PROP_BTN_TOOL_BRUSH "Button Tool Brush"
-#define BTN_LABEL_PROP_BTN_TOOL_PENCIL "Button Tool Pencil"
-#define BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH "Button Tool Airbrush"
-#define BTN_LABEL_PROP_BTN_TOOL_FINGER "Button Tool Finger"
-#define BTN_LABEL_PROP_BTN_TOOL_MOUSE "Button Tool Mouse"
-#define BTN_LABEL_PROP_BTN_TOOL_LENS "Button Tool Lens"
-#define BTN_LABEL_PROP_BTN_TOUCH "Button Touch"
-#define BTN_LABEL_PROP_BTN_STYLUS "Button Stylus"
-#define BTN_LABEL_PROP_BTN_STYLUS2 "Button Stylus2"
-#define BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP "Button Tool Doubletap"
-#define BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP "Button Tool Tripletap"
-
-#define BTN_LABEL_PROP_BTN_GEAR_DOWN "Button Gear down"
-#define BTN_LABEL_PROP_BTN_GEAR_UP "Button Gear up"
-
-#endif
+/*
+ * Copyright 2008 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software")
+ * to deal in the software without restriction, including without limitation
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, and/or sell copies of the Software, and to permit persons to whom
+ * them Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+
+/* Properties managed by the server. */
+
+#ifndef _XSERVER_PROPERTIES_H_
+#define _XSERVER_PROPERTIES_H_
+
+/* Type for a 4 byte float. Storage format IEEE 754 in client's default
+ * byte-ordering. */
+#define XATOM_FLOAT "FLOAT"
+
+/* BOOL. 0 - device disabled, 1 - device enabled */
+#define XI_PROP_ENABLED "Device Enabled"
+/* BOOL. If present, device is a virtual XTEST device */
+#define XI_PROP_XTEST_DEVICE "XTEST Device"
+
+/* CARD32, 2 values, vendor, product.
+ * This property is set by the driver and may not be available for some
+ * drivers. Read-Only */
+#define XI_PROP_PRODUCT_ID "Device Product ID"
+
+/* Coordinate transformation matrix for absolute input devices
+ * FLOAT, 9 values in row-major order, coordinates in 0..1 range:
+ * [c0 c1 c2] [x]
+ * [c3 c4 c5] * [y]
+ * [c6 c7 c8] [1] */
+#define XI_PROP_TRANSFORM "Coordinate Transformation Matrix"
+
+/* STRING. Device node path of device */
+#define XI_PROP_DEVICE_NODE "Device Node"
+
+/* Pointer acceleration properties */
+/* INTEGER of any format */
+#define ACCEL_PROP_PROFILE_NUMBER "Device Accel Profile"
+/* FLOAT, format 32 */
+#define ACCEL_PROP_CONSTANT_DECELERATION "Device Accel Constant Deceleration"
+/* FLOAT, format 32 */
+#define ACCEL_PROP_ADAPTIVE_DECELERATION "Device Accel Adaptive Deceleration"
+/* FLOAT, format 32 */
+#define ACCEL_PROP_VELOCITY_SCALING "Device Accel Velocity Scaling"
+
+
+/* Axis labels */
+#define AXIS_LABEL_PROP "Axis Labels"
+
+#define AXIS_LABEL_PROP_REL_X "Rel X"
+#define AXIS_LABEL_PROP_REL_Y "Rel Y"
+#define AXIS_LABEL_PROP_REL_Z "Rel Z"
+#define AXIS_LABEL_PROP_REL_RX "Rel Rotary X"
+#define AXIS_LABEL_PROP_REL_RY "Rel Rotary Y"
+#define AXIS_LABEL_PROP_REL_RZ "Rel Rotary Z"
+#define AXIS_LABEL_PROP_REL_HWHEEL "Rel Horiz Wheel"
+#define AXIS_LABEL_PROP_REL_DIAL "Rel Dial"
+#define AXIS_LABEL_PROP_REL_WHEEL "Rel Vert Wheel"
+#define AXIS_LABEL_PROP_REL_MISC "Rel Misc"
+
+/*
+ * Absolute axes
+ */
+
+#define AXIS_LABEL_PROP_ABS_X "Abs X"
+#define AXIS_LABEL_PROP_ABS_Y "Abs Y"
+#define AXIS_LABEL_PROP_ABS_Z "Abs Z"
+#define AXIS_LABEL_PROP_ABS_RX "Abs Rotary X"
+#define AXIS_LABEL_PROP_ABS_RY "Abs Rotary Y"
+#define AXIS_LABEL_PROP_ABS_RZ "Abs Rotary Z"
+#define AXIS_LABEL_PROP_ABS_THROTTLE "Abs Throttle"
+#define AXIS_LABEL_PROP_ABS_RUDDER "Abs Rudder"
+#define AXIS_LABEL_PROP_ABS_WHEEL "Abs Wheel"
+#define AXIS_LABEL_PROP_ABS_GAS "Abs Gas"
+#define AXIS_LABEL_PROP_ABS_BRAKE "Abs Brake"
+#define AXIS_LABEL_PROP_ABS_HAT0X "Abs Hat 0 X"
+#define AXIS_LABEL_PROP_ABS_HAT0Y "Abs Hat 0 Y"
+#define AXIS_LABEL_PROP_ABS_HAT1X "Abs Hat 1 X"
+#define AXIS_LABEL_PROP_ABS_HAT1Y "Abs Hat 1 Y"
+#define AXIS_LABEL_PROP_ABS_HAT2X "Abs Hat 2 X"
+#define AXIS_LABEL_PROP_ABS_HAT2Y "Abs Hat 2 Y"
+#define AXIS_LABEL_PROP_ABS_HAT3X "Abs Hat 3 X"
+#define AXIS_LABEL_PROP_ABS_HAT3Y "Abs Hat 3 Y"
+#define AXIS_LABEL_PROP_ABS_PRESSURE "Abs Pressure"
+#define AXIS_LABEL_PROP_ABS_DISTANCE "Abs Distance"
+#define AXIS_LABEL_PROP_ABS_TILT_X "Abs Tilt X"
+#define AXIS_LABEL_PROP_ABS_TILT_Y "Abs Tilt Y"
+#define AXIS_LABEL_PROP_ABS_TOOL_WIDTH "Abs Tool Width"
+#define AXIS_LABEL_PROP_ABS_VOLUME "Abs Volume"
+#define AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR "Abs MT Touch Major"
+#define AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR "Abs MT Touch Minor"
+#define AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR "Abs MT Width Major"
+#define AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR "Abs MT Width Minor"
+#define AXIS_LABEL_PROP_ABS_MT_ORIENTATION "Abs MT Orientation"
+#define AXIS_LABEL_PROP_ABS_MT_POSITION_X "Abs MT Position X"
+#define AXIS_LABEL_PROP_ABS_MT_POSITION_Y "Abs MT Position Y"
+#define AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE "Abs MT Tool Type"
+#define AXIS_LABEL_PROP_ABS_MT_BLOB_ID "Abs MT Blob ID"
+#define AXIS_LABEL_PROP_ABS_MT_TRACKING_ID "Abs MT Tracking ID"
+#define AXIS_LABEL_PROP_ABS_MT_PRESSURE "Abs MT Pressure"
+#define AXIS_LABEL_PROP_ABS_MISC "Abs Misc"
+
+/* Button names */
+#define BTN_LABEL_PROP "Button Labels"
+
+/* Default label */
+#define BTN_LABEL_PROP_BTN_UNKNOWN "Button Unknown"
+/* Wheel buttons */
+#define BTN_LABEL_PROP_BTN_WHEEL_UP "Button Wheel Up"
+#define BTN_LABEL_PROP_BTN_WHEEL_DOWN "Button Wheel Down"
+#define BTN_LABEL_PROP_BTN_HWHEEL_LEFT "Button Horiz Wheel Left"
+#define BTN_LABEL_PROP_BTN_HWHEEL_RIGHT "Button Horiz Wheel Right"
+
+/* The following are from linux/input.h */
+#define BTN_LABEL_PROP_BTN_0 "Button 0"
+#define BTN_LABEL_PROP_BTN_1 "Button 1"
+#define BTN_LABEL_PROP_BTN_2 "Button 2"
+#define BTN_LABEL_PROP_BTN_3 "Button 3"
+#define BTN_LABEL_PROP_BTN_4 "Button 4"
+#define BTN_LABEL_PROP_BTN_5 "Button 5"
+#define BTN_LABEL_PROP_BTN_6 "Button 6"
+#define BTN_LABEL_PROP_BTN_7 "Button 7"
+#define BTN_LABEL_PROP_BTN_8 "Button 8"
+#define BTN_LABEL_PROP_BTN_9 "Button 9"
+
+#define BTN_LABEL_PROP_BTN_LEFT "Button Left"
+#define BTN_LABEL_PROP_BTN_RIGHT "Button Right"
+#define BTN_LABEL_PROP_BTN_MIDDLE "Button Middle"
+#define BTN_LABEL_PROP_BTN_SIDE "Button Side"
+#define BTN_LABEL_PROP_BTN_EXTRA "Button Extra"
+#define BTN_LABEL_PROP_BTN_FORWARD "Button Forward"
+#define BTN_LABEL_PROP_BTN_BACK "Button Back"
+#define BTN_LABEL_PROP_BTN_TASK "Button Task"
+
+#define BTN_LABEL_PROP_BTN_TRIGGER "Button Trigger"
+#define BTN_LABEL_PROP_BTN_THUMB "Button Thumb"
+#define BTN_LABEL_PROP_BTN_THUMB2 "Button Thumb2"
+#define BTN_LABEL_PROP_BTN_TOP "Button Top"
+#define BTN_LABEL_PROP_BTN_TOP2 "Button Top2"
+#define BTN_LABEL_PROP_BTN_PINKIE "Button Pinkie"
+#define BTN_LABEL_PROP_BTN_BASE "Button Base"
+#define BTN_LABEL_PROP_BTN_BASE2 "Button Base2"
+#define BTN_LABEL_PROP_BTN_BASE3 "Button Base3"
+#define BTN_LABEL_PROP_BTN_BASE4 "Button Base4"
+#define BTN_LABEL_PROP_BTN_BASE5 "Button Base5"
+#define BTN_LABEL_PROP_BTN_BASE6 "Button Base6"
+#define BTN_LABEL_PROP_BTN_DEAD "Button Dead"
+
+#define BTN_LABEL_PROP_BTN_A "Button A"
+#define BTN_LABEL_PROP_BTN_B "Button B"
+#define BTN_LABEL_PROP_BTN_C "Button C"
+#define BTN_LABEL_PROP_BTN_X "Button X"
+#define BTN_LABEL_PROP_BTN_Y "Button Y"
+#define BTN_LABEL_PROP_BTN_Z "Button Z"
+#define BTN_LABEL_PROP_BTN_TL "Button T Left"
+#define BTN_LABEL_PROP_BTN_TR "Button T Right"
+#define BTN_LABEL_PROP_BTN_TL2 "Button T Left2"
+#define BTN_LABEL_PROP_BTN_TR2 "Button T Right2"
+#define BTN_LABEL_PROP_BTN_SELECT "Button Select"
+#define BTN_LABEL_PROP_BTN_START "Button Start"
+#define BTN_LABEL_PROP_BTN_MODE "Button Mode"
+#define BTN_LABEL_PROP_BTN_THUMBL "Button Thumb Left"
+#define BTN_LABEL_PROP_BTN_THUMBR "Button Thumb Right"
+
+#define BTN_LABEL_PROP_BTN_TOOL_PEN "Button Tool Pen"
+#define BTN_LABEL_PROP_BTN_TOOL_RUBBER "Button Tool Rubber"
+#define BTN_LABEL_PROP_BTN_TOOL_BRUSH "Button Tool Brush"
+#define BTN_LABEL_PROP_BTN_TOOL_PENCIL "Button Tool Pencil"
+#define BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH "Button Tool Airbrush"
+#define BTN_LABEL_PROP_BTN_TOOL_FINGER "Button Tool Finger"
+#define BTN_LABEL_PROP_BTN_TOOL_MOUSE "Button Tool Mouse"
+#define BTN_LABEL_PROP_BTN_TOOL_LENS "Button Tool Lens"
+#define BTN_LABEL_PROP_BTN_TOUCH "Button Touch"
+#define BTN_LABEL_PROP_BTN_STYLUS "Button Stylus"
+#define BTN_LABEL_PROP_BTN_STYLUS2 "Button Stylus2"
+#define BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP "Button Tool Doubletap"
+#define BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP "Button Tool Tripletap"
+
+#define BTN_LABEL_PROP_BTN_GEAR_DOWN "Button Gear down"
+#define BTN_LABEL_PROP_BTN_GEAR_UP "Button Gear up"
+
+#endif
diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c
index 73f814ef2..f71e327ec 100644
--- a/xorg-server/mi/mieq.c
+++ b/xorg-server/mi/mieq.c
@@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group.
# include "windowstr.h"
# include "pixmapstr.h"
# include "inputstr.h"
+# include "inpututils.h"
# include "mi.h"
# include "mipointer.h"
# include "scrnintstr.h"
diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c
index 7877aec11..6777a22ad 100644
--- a/xorg-server/randr/rrscreen.c
+++ b/xorg-server/randr/rrscreen.c
@@ -910,12 +910,6 @@ ProcRRSetScreenConfig (ClientPtr client)
*/
width = mode->mode.width;
height = mode->mode.height;
- if (rotation & (RR_Rotate_90|RR_Rotate_270))
- {
- width = mode->mode.height;
- height = mode->mode.width;
- }
-
if (width < pScrPriv->minWidth || pScrPriv->maxWidth < width) {
client->errorValue = width;
free(pData);
@@ -927,6 +921,12 @@ ProcRRSetScreenConfig (ClientPtr client)
return BadValue;
}
+ if (rotation & (RR_Rotate_90|RR_Rotate_270))
+ {
+ width = mode->mode.height;
+ height = mode->mode.width;
+ }
+
if (width != pScreen->width || height != pScreen->height)
{
int c;
diff --git a/xorg-server/xkeyboard-config/rules/base.extras.xml.in b/xorg-server/xkeyboard-config/rules/base.extras.xml.in
index 74adfde49..b2c8e40b8 100644
--- a/xorg-server/xkeyboard-config/rules/base.extras.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.extras.xml.in
@@ -191,6 +191,16 @@
<variantList>
<variant>
<configItem>
+ <name>crh_dobruja</name>
+ <_shortDescription>crh</_shortDescription>
+ <_description>Crimean Tatar (Dobruja Q)</_description>
+ <languageList>
+ <iso639Id>crh</iso639Id>
+ </languageList>
+ </configItem>
+ </variant>
+ <variant>
+ <configItem>
<name>ergonomic</name>
<_description>Romanian (ergonomic Touchtype)</_description>
</configItem>
@@ -252,7 +262,7 @@
<variant>
<configItem>
<name>olpc-phonetic</name>
- <_description>Armenian (alternative phonetic for OLPC)</_description>
+ <_description>Armenian (OLPC phonetic)</_description>
</configItem>
</variant>
</variantList>
diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in
index 0b180311e..7bfbb17f0 100644
--- a/xorg-server/xkeyboard-config/rules/base.xml.in
+++ b/xorg-server/xkeyboard-config/rules/base.xml.in
@@ -3891,16 +3891,6 @@
<_description>Romanian (WinKeys)</_description>
</configItem>
</variant>
- <variant>
- <configItem>
- <name>crh_dobruja</name>
- <_shortDescription>crh</_shortDescription>
- <_description>Crimean Tatar (Dobruja Q)</_description>
- <languageList>
- <iso639Id>crh</iso639Id>
- </languageList>
- </configItem>
- </variant>
</variantList>
</layout>
<layout>