diff -Naur fb/fb_dri.c fb.span/fb_dri.c --- fb/fb_dri.c 2005-07-26 05:44:02.000000000 +0300 +++ fb.span/fb_dri.c 2005-08-16 23:36:34.000000000 +0300 @@ -44,7 +44,6 @@ #include "driver.h" #include "drm.h" #include "utils.h" -#include "drirenderbuffer.h" #include "buffers.h" #include "extensions.h" @@ -58,7 +57,7 @@ #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" -void fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis); +#include "fb_span.h" typedef struct { GLcontext *glCtx; /* Mesa context */ @@ -133,172 +132,6 @@ } -/* - * Generate code for span functions. - */ - -/* 24-bit BGR */ -#define NAME(PREFIX) PREFIX##_B8G8R8 -#define FORMAT GL_RGBA8 -#define SPAN_VARS \ - driRenderbuffer *drb = (driRenderbuffer *) rb; -#define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = (GLubyte *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 3; -#define INC_PIXEL_PTR(P) P += 3 -#define STORE_PIXEL(DST, X, Y, VALUE) \ - DST[0] = VALUE[BCOMP]; \ - DST[1] = VALUE[GCOMP]; \ - DST[2] = VALUE[RCOMP] -#define FETCH_PIXEL(DST, SRC) \ - DST[RCOMP] = SRC[2]; \ - DST[GCOMP] = SRC[1]; \ - DST[BCOMP] = SRC[0]; \ - DST[ACOMP] = 0xff - -#include "swrast/s_spantemp.h" - - -/* 32-bit BGRA */ -#define NAME(PREFIX) PREFIX##_B8G8R8A8 -#define FORMAT GL_RGBA8 -#define SPAN_VARS \ - driRenderbuffer *drb = (driRenderbuffer *) rb; -#define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = (GLubyte *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 4; -#define INC_PIXEL_PTR(P) P += 4 -#define STORE_PIXEL(DST, X, Y, VALUE) \ - DST[0] = VALUE[BCOMP]; \ - DST[1] = VALUE[GCOMP]; \ - DST[2] = VALUE[RCOMP]; \ - DST[3] = VALUE[ACOMP] -#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ - DST[0] = VALUE[BCOMP]; \ - DST[1] = VALUE[GCOMP]; \ - DST[2] = VALUE[RCOMP]; \ - DST[3] = 0xff -#define FETCH_PIXEL(DST, SRC) \ - DST[RCOMP] = SRC[2]; \ - DST[GCOMP] = SRC[1]; \ - DST[BCOMP] = SRC[0]; \ - DST[ACOMP] = SRC[3] - -#include "swrast/s_spantemp.h" - - -/* 16-bit BGR (XXX implement dithering someday) */ -#define NAME(PREFIX) PREFIX##_B5G6R5 -#define FORMAT GL_RGBA8 -#define SPAN_VARS \ - driRenderbuffer *drb = (driRenderbuffer *) rb; -#define INIT_PIXEL_PTR(P, X, Y) \ - GLushort *P = (GLushort *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 2; -#define INC_PIXEL_PTR(P) P += 1 -#define STORE_PIXEL(DST, X, Y, VALUE) \ - DST[0] = ( (((VALUE[RCOMP]) & 0xf8) << 8) | (((VALUE[GCOMP]) & 0xfc) << 3) | ((VALUE[BCOMP]) >> 3) ) -#define FETCH_PIXEL(DST, SRC) \ - DST[RCOMP] = ( (((SRC[0]) >> 8) & 0xf8) | (((SRC[0]) >> 11) & 0x7) ); \ - DST[GCOMP] = ( (((SRC[0]) >> 3) & 0xfc) | (((SRC[0]) >> 5) & 0x3) ); \ - DST[BCOMP] = ( (((SRC[0]) << 3) & 0xf8) | (((SRC[0]) ) & 0x7) ); \ - DST[ACOMP] = 0xff - -#include "swrast/s_spantemp.h" - - -/* 15-bit BGR (XXX implement dithering someday) */ -#define NAME(PREFIX) PREFIX##_B5G5R5 -#define FORMAT GL_RGBA8 -#define SPAN_VARS \ - driRenderbuffer *drb = (driRenderbuffer *) rb; -#define INIT_PIXEL_PTR(P, X, Y) \ - GLushort *P = (GLushort *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 2; -#define INC_PIXEL_PTR(P) P += 1 -#define STORE_PIXEL(DST, X, Y, VALUE) \ - DST[0] = ( (((VALUE[RCOMP]) & 0xf8) << 7) | (((VALUE[GCOMP]) & 0xf8) << 2) | ((VALUE[BCOMP]) >> 3) ) -#define FETCH_PIXEL(DST, SRC) \ - DST[RCOMP] = ( (((SRC[0]) >> 7) & 0xf8) | (((SRC[0]) >> 10) & 0x7) ); \ - DST[GCOMP] = ( (((SRC[0]) >> 2) & 0xf8) | (((SRC[0]) >> 5) & 0x7) ); \ - DST[BCOMP] = ( (((SRC[0]) << 3) & 0xf8) | (((SRC[0]) ) & 0x7) ); \ - DST[ACOMP] = 0xff - -#include "swrast/s_spantemp.h" - - -/* 8-bit color index */ -#define NAME(PREFIX) PREFIX##_CI8 -#define FORMAT GL_COLOR_INDEX8_EXT -#define SPAN_VARS \ - driRenderbuffer *drb = (driRenderbuffer *) rb; -#define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = (GLubyte *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X); -#define INC_PIXEL_PTR(P) P += 1 -#define STORE_PIXEL(DST, X, Y, VALUE) \ - *DST = VALUE[0] -#define FETCH_PIXEL(DST, SRC) \ - DST = SRC[0] - -#include "swrast/s_spantemp.h" - - - -void -fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) -{ - ASSERT(drb->Base.InternalFormat == GL_RGBA); - if (drb->Base.InternalFormat == GL_RGBA) { - if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - drb->Base.GetRow = get_row_B5G6R5; - drb->Base.GetValues = get_values_B5G6R5; - drb->Base.PutRow = put_row_B5G6R5; - drb->Base.PutMonoRow = put_mono_row_B5G6R5; - drb->Base.PutRowRGB = put_row_rgb_B5G6R5; - drb->Base.PutValues = put_values_B5G6R5; - drb->Base.PutMonoValues = put_mono_values_B5G6R5; - } - else if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) { - drb->Base.GetRow = get_row_B5G5R5; - drb->Base.GetValues = get_values_B5G5R5; - drb->Base.PutRow = put_row_B5G5R5; - drb->Base.PutMonoRow = put_mono_row_B5G5R5; - drb->Base.PutRowRGB = put_row_rgb_B5G5R5; - drb->Base.PutValues = put_values_B5G5R5; - drb->Base.PutMonoValues = put_mono_values_B5G5R5; - } - else if (vis->redBits == 8 && vis->greenBits == 8 && vis->blueBits == 8 - && vis->alphaBits == 8) { - drb->Base.GetRow = get_row_B8G8R8A8; - drb->Base.GetValues = get_values_B8G8R8A8; - drb->Base.PutRow = put_row_B8G8R8A8; - drb->Base.PutMonoRow = put_mono_row_B8G8R8A8; - drb->Base.PutRowRGB = put_row_rgb_B8G8R8A8; - drb->Base.PutValues = put_values_B8G8R8A8; - drb->Base.PutMonoValues = put_mono_values_B8G8R8A8; - } - else if (vis->redBits == 8 && vis->greenBits == 8 && vis->blueBits == 8 - && vis->alphaBits == 0) { - drb->Base.GetRow = get_row_B8G8R8; - drb->Base.GetValues = get_values_B8G8R8; - drb->Base.PutRow = put_row_B8G8R8; - drb->Base.PutMonoRow = put_mono_row_B8G8R8; - drb->Base.PutRowRGB = put_row_rgb_B8G8R8; - drb->Base.PutValues = put_values_B8G8R8; - drb->Base.PutMonoValues = put_mono_values_B8G8R8; - } - else if (vis->indexBits == 8) { - drb->Base.GetRow = get_row_CI8; - drb->Base.GetValues = get_values_CI8; - drb->Base.PutRow = put_row_CI8; - drb->Base.PutMonoRow = put_mono_row_CI8; - drb->Base.PutValues = put_values_CI8; - drb->Base.PutMonoValues = put_mono_values_CI8; - } - } - else { - /* hardware z/stencil/etc someday */ - } -} - - - /* Initialize the driver specific screen private data. */ static GLboolean @@ -313,13 +146,6 @@ { } -void fbSetBuffer( GLcontext *ctx, - GLframebuffer *colorBuffer, - GLuint bufferBit ) -{ - /* NOP until SetBuffer is fully removed */ -} - /* Create the device specific context. */ static GLboolean diff -Naur fb/fb_egl.c fb.span/fb_egl.c --- fb/fb_egl.c 2005-08-05 06:33:59.000000000 +0300 +++ fb.span/fb_egl.c 2005-08-19 19:57:27.000000000 +0300 @@ -24,7 +24,6 @@ #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" -#include "drirenderbuffer.h" #include "eglconfig.h" #include "eglcontext.h" @@ -35,10 +34,13 @@ #include "eglscreen.h" #include "eglsurface.h" -extern void -fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis); -extern void -fbSetBuffer( GLcontext *ctx, GLframebuffer *colorBuffer, GLuint bufferBit); +#include "fb_span.h" + +#include "extension_helper.h" + +const struct dri_extension card_extensions[] = { + { NULL, NULL } +}; /** * fb driver-specific driver class derived from _EGLDriver @@ -130,7 +132,8 @@ fb_format = GL_RGB; fb_type = GL_UNSIGNED_SHORT_5_6_5; } else { - fb_format = GL_RGBA; + fb_format = GL_RGB; /* 24 bpp + 0 alpha, for my fbdev */ + fb_format = GL_RGBA; /* 24 bpp + 8 alpha, for my xf86 */ fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; } @@ -313,6 +316,7 @@ fbFillInConfigs(&display->Base, 32, 24, 8, 1); + driInitExtensions( NULL, card_extensions, GL_FALSE ); } closedir(dir); @@ -496,6 +500,7 @@ tnl->Driver.RunPipeline = _tnl_run_pipeline; } + driInitExtensions( ctx, card_extensions, GL_TRUE ); _mesa_enable_sw_extensions(ctx); return c->Base.Handle; diff -Naur fb/fb_span.c fb.span/fb_span.c --- fb/fb_span.c 1970-01-01 02:00:00.000000000 +0200 +++ fb.span/fb_span.c 2005-08-16 23:32:33.000000000 +0300 @@ -0,0 +1,197 @@ +/* + * Mesa 3-D graphics library + * Version: 6.3 + * + * Copyright (C) 1999-2005 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. + */ + +#include "fb_span.h" + +/* + * Generate code for span functions. + */ + +/* 24-bit BGR */ +#define NAME(PREFIX) PREFIX##_B8G8R8 +#define FORMAT GL_RGBA8 +#define SPAN_VARS \ + driRenderbuffer *drb = (driRenderbuffer *) rb; +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 3; +#define INC_PIXEL_PTR(P) P += 3 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + DST[0] = VALUE[BCOMP]; \ + DST[1] = VALUE[GCOMP]; \ + DST[2] = VALUE[RCOMP] +#define FETCH_PIXEL(DST, SRC) \ + DST[RCOMP] = SRC[2]; \ + DST[GCOMP] = SRC[1]; \ + DST[BCOMP] = SRC[0]; \ + DST[ACOMP] = 0xff + +#include "swrast/s_spantemp.h" + + +/* 32-bit BGRA */ +#define NAME(PREFIX) PREFIX##_B8G8R8A8 +#define FORMAT GL_RGBA8 +#define SPAN_VARS \ + driRenderbuffer *drb = (driRenderbuffer *) rb; +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 4; +#define INC_PIXEL_PTR(P) P += 4 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + DST[0] = VALUE[BCOMP]; \ + DST[1] = VALUE[GCOMP]; \ + DST[2] = VALUE[RCOMP]; \ + DST[3] = VALUE[ACOMP] +#define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ + DST[0] = VALUE[BCOMP]; \ + DST[1] = VALUE[GCOMP]; \ + DST[2] = VALUE[RCOMP]; \ + DST[3] = 0xff +#define FETCH_PIXEL(DST, SRC) \ + DST[RCOMP] = SRC[2]; \ + DST[GCOMP] = SRC[1]; \ + DST[BCOMP] = SRC[0]; \ + DST[ACOMP] = SRC[3] + +#include "swrast/s_spantemp.h" + + +/* 16-bit BGR (XXX implement dithering someday) */ +#define NAME(PREFIX) PREFIX##_B5G6R5 +#define FORMAT GL_RGBA8 +#define SPAN_VARS \ + driRenderbuffer *drb = (driRenderbuffer *) rb; +#define INIT_PIXEL_PTR(P, X, Y) \ + GLushort *P = (GLushort *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 2; +#define INC_PIXEL_PTR(P) P += 1 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + DST[0] = ( (((VALUE[RCOMP]) & 0xf8) << 8) | (((VALUE[GCOMP]) & 0xfc) << 3) | ((VALUE[BCOMP]) >> 3) ) +#define FETCH_PIXEL(DST, SRC) \ + DST[RCOMP] = ( (((SRC[0]) >> 8) & 0xf8) | (((SRC[0]) >> 11) & 0x7) ); \ + DST[GCOMP] = ( (((SRC[0]) >> 3) & 0xfc) | (((SRC[0]) >> 5) & 0x3) ); \ + DST[BCOMP] = ( (((SRC[0]) << 3) & 0xf8) | (((SRC[0]) ) & 0x7) ); \ + DST[ACOMP] = 0xff + +#include "swrast/s_spantemp.h" + + +/* 15-bit BGR (XXX implement dithering someday) */ +#define NAME(PREFIX) PREFIX##_B5G5R5 +#define FORMAT GL_RGBA8 +#define SPAN_VARS \ + driRenderbuffer *drb = (driRenderbuffer *) rb; +#define INIT_PIXEL_PTR(P, X, Y) \ + GLushort *P = (GLushort *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X) * 2; +#define INC_PIXEL_PTR(P) P += 1 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + DST[0] = ( (((VALUE[RCOMP]) & 0xf8) << 7) | (((VALUE[GCOMP]) & 0xf8) << 2) | ((VALUE[BCOMP]) >> 3) ) +#define FETCH_PIXEL(DST, SRC) \ + DST[RCOMP] = ( (((SRC[0]) >> 7) & 0xf8) | (((SRC[0]) >> 10) & 0x7) ); \ + DST[GCOMP] = ( (((SRC[0]) >> 2) & 0xf8) | (((SRC[0]) >> 5) & 0x7) ); \ + DST[BCOMP] = ( (((SRC[0]) << 3) & 0xf8) | (((SRC[0]) ) & 0x7) ); \ + DST[ACOMP] = 0xff + +#include "swrast/s_spantemp.h" + + +/* 8-bit color index */ +#define NAME(PREFIX) PREFIX##_CI8 +#define FORMAT GL_COLOR_INDEX8_EXT +#define SPAN_VARS \ + driRenderbuffer *drb = (driRenderbuffer *) rb; +#define INIT_PIXEL_PTR(P, X, Y) \ + GLubyte *P = (GLubyte *)drb->Base.Data + (drb->Base.Height - (Y)) * drb->pitch + (X); +#define INC_PIXEL_PTR(P) P += 1 +#define STORE_PIXEL(DST, X, Y, VALUE) \ + *DST = VALUE[0] +#define FETCH_PIXEL(DST, SRC) \ + DST = SRC[0] + +#include "swrast/s_spantemp.h" + + + +void +fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +{ + ASSERT(drb->Base.InternalFormat == GL_RGBA); + if (drb->Base.InternalFormat == GL_RGBA) { + if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { + drb->Base.GetRow = get_row_B5G6R5; + drb->Base.GetValues = get_values_B5G6R5; + drb->Base.PutRow = put_row_B5G6R5; + drb->Base.PutMonoRow = put_mono_row_B5G6R5; + drb->Base.PutRowRGB = put_row_rgb_B5G6R5; + drb->Base.PutValues = put_values_B5G6R5; + drb->Base.PutMonoValues = put_mono_values_B5G6R5; + } + else if (vis->redBits == 5 && vis->greenBits == 5 && vis->blueBits == 5) { + drb->Base.GetRow = get_row_B5G5R5; + drb->Base.GetValues = get_values_B5G5R5; + drb->Base.PutRow = put_row_B5G5R5; + drb->Base.PutMonoRow = put_mono_row_B5G5R5; + drb->Base.PutRowRGB = put_row_rgb_B5G5R5; + drb->Base.PutValues = put_values_B5G5R5; + drb->Base.PutMonoValues = put_mono_values_B5G5R5; + } + else if (vis->redBits == 8 && vis->greenBits == 8 && vis->blueBits == 8 + && vis->alphaBits == 8) { + drb->Base.GetRow = get_row_B8G8R8A8; + drb->Base.GetValues = get_values_B8G8R8A8; + drb->Base.PutRow = put_row_B8G8R8A8; + drb->Base.PutMonoRow = put_mono_row_B8G8R8A8; + drb->Base.PutRowRGB = put_row_rgb_B8G8R8A8; + drb->Base.PutValues = put_values_B8G8R8A8; + drb->Base.PutMonoValues = put_mono_values_B8G8R8A8; + } + else if (vis->redBits == 8 && vis->greenBits == 8 && vis->blueBits == 8 + && vis->alphaBits == 0) { + drb->Base.GetRow = get_row_B8G8R8; + drb->Base.GetValues = get_values_B8G8R8; + drb->Base.PutRow = put_row_B8G8R8; + drb->Base.PutMonoRow = put_mono_row_B8G8R8; + drb->Base.PutRowRGB = put_row_rgb_B8G8R8; + drb->Base.PutValues = put_values_B8G8R8; + drb->Base.PutMonoValues = put_mono_values_B8G8R8; + } + else if (vis->indexBits == 8) { + drb->Base.GetRow = get_row_CI8; + drb->Base.GetValues = get_values_CI8; + drb->Base.PutRow = put_row_CI8; + drb->Base.PutMonoRow = put_mono_row_CI8; + drb->Base.PutValues = put_values_CI8; + drb->Base.PutMonoValues = put_mono_values_CI8; + } + } + else { + /* hardware z/stencil/etc someday */ + } +} + + +void fbSetBuffer( GLcontext *ctx, + GLframebuffer *colorBuffer, + GLuint bufferBit ) +{ + /* NOP until SetBuffer is fully removed */ +} diff -Naur fb/fb_span.h fb.span/fb_span.h --- fb/fb_span.h 1970-01-01 02:00:00.000000000 +0200 +++ fb.span/fb_span.h 2005-08-16 23:30:34.000000000 +0300 @@ -0,0 +1,12 @@ + +#ifndef __FB_SPAN_H__ +#define __FB_SPAN_H__ + +#include "drirenderbuffer.h" + +extern void +fbSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis); +extern void +fbSetBuffer( GLcontext *ctx, GLframebuffer *colorBuffer, GLuint bufferBit); + +#endif diff -Naur fb/Makefile fb.span/Makefile --- fb/Makefile 2005-05-13 21:31:36.000000000 +0300 +++ fb.span/Makefile 2005-08-20 18:12:42.000000000 +0300 @@ -5,9 +5,15 @@ LIBNAME = fb_dri.so +MINIGLX_SOURCES = fb_dri.c + +ifeq ($(USING_EGL), 1) +EGL_SOURCES = fb_egl.c +endif + DRIVER_SOURCES = \ - fb_dri.c \ - fb_egl.c + fb_span.c \ + $(EGL_SOURCES) C_SOURCES = \ $(COMMON_SOURCES) \