diff options
-rw-r--r-- | src/mesa/drivers/fbdev/glfbdev.c | 122 |
1 files changed, 36 insertions, 86 deletions
diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c index 4e369ceac4..e6ece69a64 100644 --- a/src/mesa/drivers/fbdev/glfbdev.c +++ b/src/mesa/drivers/fbdev/glfbdev.c @@ -70,7 +70,6 @@ #define PF_B8G8R8A8 2 #define PF_B5G6R5 3 #define PF_B5G5R5 4 -#define PF_CI8 5 /** @@ -264,25 +263,6 @@ viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) #include "swrast/s_spantemp.h" -/* 8-bit color index */ -#define NAME(PREFIX) PREFIX##_CI8 -#define CI_MODE -#define RB_TYPE GLubyte -#define SPAN_VARS \ - struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb; -#define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = frb->bottom - (Y) * frb->rowStride + (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" - - - - /**********************************************************************/ /* Public API functions */ /**********************************************************************/ @@ -345,7 +325,7 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo, { GLFBDevVisualPtr vis; const int *attrib; - GLboolean rgbFlag = GL_TRUE, dbFlag = GL_FALSE, stereoFlag = GL_FALSE; + GLboolean dbFlag = GL_FALSE, stereoFlag = GL_FALSE; GLint redBits = 0, greenBits = 0, blueBits = 0, alphaBits = 0; GLint indexBits = 0, depthBits = 0, stencilBits = 0; GLint accumRedBits = 0, accumGreenBits = 0; @@ -367,9 +347,6 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo, case GLFBDEV_DOUBLE_BUFFER: dbFlag = GL_TRUE; break; - case GLFBDEV_COLOR_INDEX: - rgbFlag = GL_FALSE; - break; case GLFBDEV_DEPTH_SIZE: depthBits = attrib[1]; attrib++; @@ -390,6 +367,8 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo, numSamples = attrib[1]; attrib++; break; + case GLFBDEV_COLOR_INDEX: + /* Mesa no longer supports color-index rendering. */ default: /* unexpected token */ free(vis); @@ -397,60 +376,45 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo, } } - if (rgbFlag) { - redBits = varInfo->red.length; - greenBits = varInfo->green.length; - blueBits = varInfo->blue.length; - alphaBits = varInfo->transp.length; - - if (fixInfo->visual == FB_VISUAL_TRUECOLOR || - fixInfo->visual == FB_VISUAL_DIRECTCOLOR) { - if (varInfo->bits_per_pixel == 24 - && varInfo->red.offset == 16 - && varInfo->green.offset == 8 - && varInfo->blue.offset == 0) { - vis->pixelFormat = PF_B8G8R8; - } - else if (varInfo->bits_per_pixel == 32 - && varInfo->red.offset == 16 - && varInfo->green.offset == 8 - && varInfo->blue.offset == 0) { - vis->pixelFormat = PF_B8G8R8A8; - } - else if (varInfo->bits_per_pixel == 16 - && varInfo->red.offset == 11 - && varInfo->green.offset == 5 - && varInfo->blue.offset == 0) { - vis->pixelFormat = PF_B5G6R5; - } - else if (varInfo->bits_per_pixel == 16 - && varInfo->red.offset == 10 - && varInfo->green.offset == 5 - && varInfo->blue.offset == 0) { - vis->pixelFormat = PF_B5G5R5; - } - else { - _mesa_problem(NULL, "Unsupported fbdev RGB visual/bitdepth!\n"); - free(vis); - return NULL; - } + redBits = varInfo->red.length; + greenBits = varInfo->green.length; + blueBits = varInfo->blue.length; + alphaBits = varInfo->transp.length; + + if (fixInfo->visual == FB_VISUAL_TRUECOLOR || + fixInfo->visual == FB_VISUAL_DIRECTCOLOR) { + if (varInfo->bits_per_pixel == 24 + && varInfo->red.offset == 16 + && varInfo->green.offset == 8 + && varInfo->blue.offset == 0) { + vis->pixelFormat = PF_B8G8R8; } - } - else { - indexBits = varInfo->bits_per_pixel; - if ((fixInfo->visual == FB_VISUAL_PSEUDOCOLOR || - fixInfo->visual == FB_VISUAL_STATIC_PSEUDOCOLOR) - && varInfo->bits_per_pixel == 8) { - vis->pixelFormat = PF_CI8; + else if (varInfo->bits_per_pixel == 32 + && varInfo->red.offset == 16 + && varInfo->green.offset == 8 + && varInfo->blue.offset == 0) { + vis->pixelFormat = PF_B8G8R8A8; + } + else if (varInfo->bits_per_pixel == 16 + && varInfo->red.offset == 11 + && varInfo->green.offset == 5 + && varInfo->blue.offset == 0) { + vis->pixelFormat = PF_B5G6R5; + } + else if (varInfo->bits_per_pixel == 16 + && varInfo->red.offset == 10 + && varInfo->green.offset == 5 + && varInfo->blue.offset == 0) { + vis->pixelFormat = PF_B5G5R5; } else { - _mesa_problem(NULL, "Unsupported fbdev CI visual/bitdepth!\n"); + _mesa_problem(NULL, "Unsupported fbdev RGB visual/bitdepth!\n"); free(vis); return NULL; } } - if (!_mesa_initialize_visual(&vis->glvisual, rgbFlag, dbFlag, stereoFlag, + if (!_mesa_initialize_visual(&vis->glvisual, GL_TRUE, dbFlag, stereoFlag, redBits, greenBits, blueBits, alphaBits, indexBits, depthBits, stencilBits, accumRedBits, accumGreenBits, @@ -554,23 +518,9 @@ new_glfbdev_renderbuffer(void *bufferStart, const GLFBDevVisualPtr visual) rb->Base.PutValues = put_values_B5G5R5; rb->Base.PutMonoValues = put_mono_values_B5G5R5; } - else if (pixelFormat == PF_CI8) { - rb->Base.GetRow = get_row_CI8; - rb->Base.GetValues = get_values_CI8; - rb->Base.PutRow = put_row_CI8; - rb->Base.PutMonoRow = put_mono_row_CI8; - rb->Base.PutValues = put_values_CI8; - rb->Base.PutMonoValues = put_mono_values_CI8; - } - if (pixelFormat == PF_CI8) { - rb->Base.InternalFormat = GL_COLOR_INDEX8_EXT; - rb->Base._BaseFormat = GL_COLOR_INDEX; - } - else { - rb->Base.InternalFormat = GL_RGBA; - rb->Base._BaseFormat = GL_RGBA; - } + rb->Base.InternalFormat = GL_RGBA; + rb->Base._BaseFormat = GL_RGBA; rb->Base.DataType = GL_UNSIGNED_BYTE; rb->Base.Data = bufferStart; |