summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i810
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/i810')
-rw-r--r--src/mesa/drivers/dri/i810/i810context.c12
-rw-r--r--src/mesa/drivers/dri/i810/i810ioctl.h2
-rw-r--r--src/mesa/drivers/dri/i810/i810render.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810screen.c197
-rw-r--r--src/mesa/drivers/dri/i810/i810span.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810state.c18
-rw-r--r--src/mesa/drivers/dri/i810/i810texmem.c2
-rw-r--r--src/mesa/drivers/dri/i810/i810tris.c8
8 files changed, 67 insertions, 176 deletions
diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c
index f90b3682f8..c13b21aeb3 100644
--- a/src/mesa/drivers/dri/i810/i810context.c
+++ b/src/mesa/drivers/dri/i810/i810context.c
@@ -423,11 +423,11 @@ void i810XMesaSetBackClipRects( i810ContextPtr imesa )
static void i810XMesaWindowMoved( i810ContextPtr imesa )
{
/* Determine current color drawing buffer */
- switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
+ switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferIndexes[0]) {
+ case BUFFER_FRONT_LEFT:
i810XMesaSetFrontClipRects( imesa );
break;
- case BUFFER_BIT_BACK_LEFT:
+ case BUFFER_BACK_LEFT:
i810XMesaSetBackClipRects( imesa );
break;
default:
@@ -485,11 +485,11 @@ i810UpdatePageFlipping( i810ContextPtr imesa )
int front = 0;
/* Determine current color drawing buffer */
- switch (ctx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
+ switch (ctx->DrawBuffer->_ColorDrawBufferIndexes[0]) {
+ case BUFFER_FRONT_LEFT:
front = 1;
break;
- case BUFFER_BIT_BACK_LEFT:
+ case BUFFER_BACK_LEFT:
front = 0;
break;
default:
diff --git a/src/mesa/drivers/dri/i810/i810ioctl.h b/src/mesa/drivers/dri/i810/i810ioctl.h
index 748d29ae36..dfd6e21088 100644
--- a/src/mesa/drivers/dri/i810/i810ioctl.h
+++ b/src/mesa/drivers/dri/i810/i810ioctl.h
@@ -33,7 +33,7 @@ do { \
} \
} while (0)
-static __inline GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes )
+static INLINE GLuint *i810AllocDmaLow( i810ContextPtr imesa, int bytes )
{
if (imesa->vertex_low + bytes > imesa->vertex_high)
i810FlushPrimsGetBuffer( imesa );
diff --git a/src/mesa/drivers/dri/i810/i810render.c b/src/mesa/drivers/dri/i810/i810render.c
index a31d54236c..d0225969b6 100644
--- a/src/mesa/drivers/dri/i810/i810render.c
+++ b/src/mesa/drivers/dri/i810/i810render.c
@@ -144,7 +144,7 @@ static GLboolean i810_run_render( GLcontext *ctx,
for (i = 0 ; i < VB->PrimitiveCount ; i++)
{
- GLuint prim = VB->Primitive[i].mode;
+ GLuint prim = _tnl_translate_prim(&VB->Primitive[i]);
GLuint start = VB->Primitive[i].start;
GLuint length = VB->Primitive[i].count;
diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c
index 733c97b2ad..ea26e72fa8 100644
--- a/src/mesa/drivers/dri/i810/i810screen.c
+++ b/src/mesa/drivers/dri/i810/i810screen.c
@@ -55,77 +55,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
extern const struct dri_extension card_extensions[];
-static __GLcontextModes *fill_in_modes( __GLcontextModes *modes,
- unsigned pixel_bits,
- unsigned depth_bits,
- unsigned stencil_bits,
- const GLenum * db_modes,
- unsigned num_db_modes,
- int visType )
-{
- static const uint8_t bits[1][4] = {
- { 5, 6, 5, 0 }
- };
-
- static const uint32_t masks[1][4] = {
- { 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }
- };
-
- unsigned i;
- unsigned j;
- const unsigned index = 0;
-
- for ( i = 0 ; i < num_db_modes ; i++ ) {
- for ( j = 0 ; j < 2 ; j++ ) {
-
- modes->redBits = bits[index][0];
- modes->greenBits = bits[index][1];
- modes->blueBits = bits[index][2];
- modes->alphaBits = bits[index][3];
- modes->redMask = masks[index][0];
- modes->greenMask = masks[index][1];
- modes->blueMask = masks[index][2];
- modes->alphaMask = masks[index][3];
- modes->rgbBits = modes->redBits + modes->greenBits
- + modes->blueBits + modes->alphaBits;
-
- modes->accumRedBits = 16 * j;
- modes->accumGreenBits = 16 * j;
- modes->accumBlueBits = 16 * j;
- modes->accumAlphaBits = (masks[index][3] != 0) ? 16 * j : 0;
- modes->visualRating = (j == 0) ? GLX_NONE : GLX_SLOW_CONFIG;
-
- modes->stencilBits = stencil_bits;
- modes->depthBits = depth_bits;
-
- modes->visualType = visType;
- modes->renderType = GLX_RGBA_BIT;
- modes->drawableType = GLX_WINDOW_BIT;
- modes->rgbMode = GL_TRUE;
-
- if ( db_modes[i] == GLX_NONE ) {
- modes->doubleBufferMode = GL_FALSE;
- }
- else {
- modes->doubleBufferMode = GL_TRUE;
- modes->swapMethod = db_modes[i];
- }
-
- modes = modes->next;
- }
- }
-
- return modes;
-
-}
-
-
-static __GLcontextModes *
-i810FillInModes( unsigned pixel_bits, unsigned depth_bits,
+static const __DRIconfig **
+i810FillInModes( __DRIscreenPrivate *psp,
+ unsigned pixel_bits, unsigned depth_bits,
unsigned stencil_bits, GLboolean have_back_buffer )
-{ __GLcontextModes * modes;
+{
+ __DRIconfig **configs;
__GLcontextModes * m;
- unsigned num_modes;
unsigned depth_buffer_factor;
unsigned back_buffer_factor;
unsigned i;
@@ -139,50 +75,42 @@ i810FillInModes( unsigned pixel_bits, unsigned depth_bits,
GLX_NONE, GLX_SWAP_UNDEFINED_OML /*, GLX_SWAP_COPY_OML */
};
- int depth_buffer_modes[2][2];
+ u_int8_t depth_bits_array[2];
+ u_int8_t stencil_bits_array[2];
-
- depth_buffer_modes[0][0] = depth_bits;
- depth_buffer_modes[1][0] = depth_bits;
+ depth_bits_array[0] = depth_bits;
+ depth_bits_array[1] = depth_bits;
/* Just like with the accumulation buffer, always provide some modes
* with a stencil buffer. It will be a sw fallback, but some apps won't
* care about that.
*/
- depth_buffer_modes[0][1] = 0;
- depth_buffer_modes[1][1] = (stencil_bits == 0) ? 8 : stencil_bits;
+ stencil_bits_array[0] = 0;
+ stencil_bits_array[1] = (stencil_bits == 0) ? 8 : stencil_bits;
depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1;
back_buffer_factor = (have_back_buffer) ? 2 : 1;
- num_modes = depth_buffer_factor * back_buffer_factor * 4;
-
- modes = (*dri_interface->createContextModes)( num_modes, sizeof( __GLcontextModes ) );
- m = modes;
- for ( i = 0 ; i < depth_buffer_factor ; i++ ) {
- m = fill_in_modes( m, pixel_bits,
- depth_buffer_modes[i][0], depth_buffer_modes[i][1],
- back_buffer_modes, back_buffer_factor,
- GLX_TRUE_COLOR );
- }
-
- for ( i = 0 ; i < depth_buffer_factor ; i++ ) {
- m = fill_in_modes( m, pixel_bits,
- depth_buffer_modes[i][0], depth_buffer_modes[i][1],
- back_buffer_modes, back_buffer_factor,
- GLX_DIRECT_COLOR );
+ configs = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5,
+ depth_bits_array, stencil_bits_array,
+ depth_buffer_factor,
+ back_buffer_modes, back_buffer_factor);
+ if (configs == NULL) {
+ fprintf( stderr, "[%s:%u] Error creating FBConfig!\n",
+ __func__, __LINE__ );
+ return NULL;
}
/* Mark the visual as slow if there are "fake" stencil bits.
*/
- for ( m = modes ; m != NULL ; m = m->next ) {
- if ( (m->stencilBits != 0) && (m->stencilBits != stencil_bits) ) {
+ for (i = 0; configs[i]; i++) {
+ m = &configs[i]->modes;
+ if ((m->stencilBits != 0) && (m->stencilBits != stencil_bits)) {
m->visualRating = GLX_SLOW_CONFIG;
}
}
- return modes;
-
+ return (const __DRIconfig **) configs;
}
@@ -218,12 +146,24 @@ static drmBufMapPtr i810_create_empty_buffers(void)
}
-static GLboolean
-i810InitDriver(__DRIscreenPrivate *sPriv)
+static const __DRIconfig **
+i810InitScreen(__DRIscreen *sPriv)
{
+ static const __DRIversion ddx_expected = { 1, 0, 0 };
+ static const __DRIversion dri_expected = { 4, 0, 0 };
+ static const __DRIversion drm_expected = { 1, 2, 0 };
i810ScreenPrivate *i810Screen;
I810DRIPtr gDRIPriv = (I810DRIPtr)sPriv->pDevPriv;
+ if ( ! driCheckDriDdxDrmVersions2( "i810",
+ &sPriv->dri_version, & dri_expected,
+ &sPriv->ddx_version, & ddx_expected,
+ &sPriv->drm_version, & drm_expected ) ) {
+ return NULL;
+ }
+
+ driInitExtensions( NULL, card_extensions, GL_TRUE );
+
if (sPriv->devPrivSize != sizeof(I810DRIRec)) {
fprintf(stderr,"\nERROR! sizeof(I810DRIRec) does not match passed size from device driver\n");
return GL_FALSE;
@@ -287,8 +227,8 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
i810Screen->depth.handle,
i810Screen->depth.size,
(drmAddress *)&i810Screen->depth.map) != 0) {
- FREE(i810Screen);
drmUnmap(i810Screen->back.map, i810Screen->back.size);
+ FREE(i810Screen);
sPriv->private = NULL;
__driUtilMessage("i810InitDriver: drmMap (2) failed");
return GL_FALSE;
@@ -311,7 +251,7 @@ i810InitDriver(__DRIscreenPrivate *sPriv)
i810Screen->sarea_priv_offset = gDRIPriv->sarea_priv_offset;
- return GL_TRUE;
+ return i810FillInModes(sPriv, 16, 16, 0, 1);
}
static void
@@ -400,9 +340,8 @@ i810DestroyBuffer(__DRIdrawablePrivate *driDrawPriv)
_mesa_unreference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)));
}
-
-static const struct __DriverAPIRec i810API = {
- .InitDriver = i810InitDriver,
+const struct __DriverAPIRec driDriverAPI = {
+ .InitScreen = i810InitScreen,
.DestroyScreen = i810DestroyScreen,
.CreateContext = i810CreateContext,
.DestroyContext = i810DestroyContext,
@@ -412,60 +351,8 @@ static const struct __DriverAPIRec i810API = {
.MakeCurrent = i810MakeCurrent,
.UnbindContext = i810UnbindContext,
.GetSwapInfo = NULL,
- .GetMSC = NULL,
+ .GetDrawableMSC = NULL,
.WaitForMSC = NULL,
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL
};
-
-
-/**
- * This is the bootstrap function for the driver. libGL supplies all of the
- * requisite information about the system, and the driver initializes itself.
- * This routine also fills in the linked list pointed to by \c driver_modes
- * with the \c __GLcontextModes that the driver can support for windows or
- * pbuffers.
- *
- * \return A pointer to a \c __DRIscreenPrivate on success, or \c NULL on
- * failure.
- */
-PUBLIC
-void * __driCreateNewScreen_20050727( __DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
- const __GLcontextModes * modes,
- const __DRIversion * ddx_version,
- const __DRIversion * dri_version,
- const __DRIversion * drm_version,
- const __DRIframebuffer * frame_buffer,
- drmAddress pSAREA, int fd,
- int internal_api_version,
- const __DRIinterfaceMethods * interface,
- __GLcontextModes ** driver_modes )
-
-{
- __DRIscreenPrivate *psp;
- static const __DRIversion ddx_expected = { 1, 0, 0 };
- static const __DRIversion dri_expected = { 4, 0, 0 };
- static const __DRIversion drm_expected = { 1, 2, 0 };
-
- dri_interface = interface;
-
- if ( ! driCheckDriDdxDrmVersions2( "i810",
- dri_version, & dri_expected,
- ddx_version, & ddx_expected,
- drm_version, & drm_expected ) ) {
- return NULL;
- }
-
- psp = __driUtilCreateNewScreen(dpy, scrn, psc, NULL,
- ddx_version, dri_version, drm_version,
- frame_buffer, pSAREA, fd,
- internal_api_version, &i810API);
- if ( psp != NULL ) {
- *driver_modes = i810FillInModes( 16,
- 16, 0,
- 1);
- driInitExtensions( NULL, card_extensions, GL_TRUE );
- }
-
- return (void *) psp;
-}
diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c
index 2112800eeb..59511de973 100644
--- a/src/mesa/drivers/dri/i810/i810span.c
+++ b/src/mesa/drivers/dri/i810/i810span.c
@@ -67,6 +67,8 @@ do { \
/* 16 bit depthbuffer functions.
*/
+#define VALUE_TYPE GLushort
+
#define WRITE_DEPTH( _x, _y, d ) \
*(GLushort *)(buf + (_x)*2 + (_y)*pitch) = d;
diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c
index e203c74f52..1446324716 100644
--- a/src/mesa/drivers/dri/i810/i810state.c
+++ b/src/mesa/drivers/dri/i810/i810state.c
@@ -26,7 +26,7 @@
#include "tnl/t_pipeline.h"
-static __inline__ GLuint i810PackColor(GLuint format,
+static INLINE GLuint i810PackColor(GLuint format,
GLubyte r, GLubyte g,
GLubyte b, GLubyte a)
{
@@ -291,18 +291,20 @@ void i810DrawBuffer(GLcontext *ctx, GLenum mode )
i810ContextPtr imesa = I810_CONTEXT(ctx);
int front = 0;
- /*
- * _DrawDestMask is easier to cope with than <mode>.
- */
- switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0]) {
- case BUFFER_BIT_FRONT_LEFT:
+ if (ctx->DrawBuffer->_NumColorDrawBuffers != 1) {
+ /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
+ FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_TRUE );
+ return;
+ }
+
+ switch ( ctx->DrawBuffer->_ColorDrawBufferIndexes[0]) {
+ case BUFFER_FRONT_LEFT:
front = 1;
break;
- case BUFFER_BIT_BACK_LEFT:
+ case BUFFER_BACK_LEFT:
front = 0;
break;
default:
- /* GL_NONE or GL_FRONT_AND_BACK or stereo left&right, etc */
FALLBACK( imesa, I810_FALLBACK_DRAW_BUFFER, GL_TRUE );
return;
}
diff --git a/src/mesa/drivers/dri/i810/i810texmem.c b/src/mesa/drivers/dri/i810/i810texmem.c
index 08900cc67d..9c24fcd8f5 100644
--- a/src/mesa/drivers/dri/i810/i810texmem.c
+++ b/src/mesa/drivers/dri/i810/i810texmem.c
@@ -64,7 +64,7 @@ void i810DestroyTexObj(i810ContextPtr imesa, i810TextureObjectPtr t)
/* From linux kernel i386 header files, copes with odd sizes better
* than COPY_DWORDS would:
*/
-static __inline__ void * __memcpy(void * to, const void * from, size_t n)
+static INLINE void * __memcpy(void * to, const void * from, size_t n)
{
int d0, d1, d2;
__asm__ __volatile__(
diff --git a/src/mesa/drivers/dri/i810/i810tris.c b/src/mesa/drivers/dri/i810/i810tris.c
index 40ab436b95..0d5f5d9369 100644
--- a/src/mesa/drivers/dri/i810/i810tris.c
+++ b/src/mesa/drivers/dri/i810/i810tris.c
@@ -74,7 +74,7 @@ do { \
} while (0)
#endif
-static __inline__ void i810_draw_triangle( i810ContextPtr imesa,
+static INLINE void i810_draw_triangle( i810ContextPtr imesa,
i810VertexPtr v0,
i810VertexPtr v1,
i810VertexPtr v2 )
@@ -89,7 +89,7 @@ static __inline__ void i810_draw_triangle( i810ContextPtr imesa,
}
-static __inline__ void i810_draw_quad( i810ContextPtr imesa,
+static INLINE void i810_draw_quad( i810ContextPtr imesa,
i810VertexPtr v0,
i810VertexPtr v1,
i810VertexPtr v2,
@@ -108,7 +108,7 @@ static __inline__ void i810_draw_quad( i810ContextPtr imesa,
}
-static __inline__ void i810_draw_point( i810ContextPtr imesa,
+static INLINE void i810_draw_point( i810ContextPtr imesa,
i810VertexPtr tmp )
{
GLfloat sz = 0.5 * CLAMP(imesa->glCtx->Point.Size,
@@ -132,7 +132,7 @@ static __inline__ void i810_draw_point( i810ContextPtr imesa,
}
-static __inline__ void i810_draw_line( i810ContextPtr imesa,
+static INLINE void i810_draw_line( i810ContextPtr imesa,
i810VertexPtr v0,
i810VertexPtr v1 )
{