From 7e4152f0ed46f644a4247444e18dc7ad6c9832b0 Mon Sep 17 00:00:00 2001 From: Sean D'Epagnier Date: Fri, 18 Aug 2006 10:38:15 +0000 Subject: The driver now compiles correctly without any x headers or libraries installed The bitmap and stroke code can't be shared with glx anymore because of this. The model for the mini teapot is restored and I have tested it to work with linux-fbdev and linux-solo The driver recognizes 32bpp where there is no alpha (my radeon 7500) It also sets the correct number of cmap entrees (instead of 256 which can be an error) --- src/mesa/Makefile | 16 +++++---- src/mesa/drivers/fbdev/glfbdev.c | 74 ++++++++++++++++++---------------------- 2 files changed, 44 insertions(+), 46 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/Makefile b/src/mesa/Makefile index bf600e0578..16cf6709ea 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -38,7 +38,6 @@ default: fi - ###################################################################### # BeOS driver target @@ -74,13 +73,17 @@ directfb: depend subdirs libgl-core ###################################################################### # Stand-alone Mesa libGL and libOSMesa - -STAND_ALONE_DRIVER_SOURCES = \ +STAND_ALONE_DRIVER_SOURCES_A = \ $(COMMON_DRIVER_SOURCES) \ - $(X11_DRIVER_SOURCES) \ $(GLIDE_DRIVER_SOURCES) \ - $(SVGA_DRIVER_SOURCES) \ - $(FBDEV_DRIVER_SOURCES) + $(SVGA_DRIVER_SOURCES) + +# if x11 is not installed, compiling with x11 sources will not work for fbdev +ifeq ($(DRIVER_DIRS), fbdev) +STAND_ALONE_DRIVER_SOURCES = $(STAND_ALONE_DRIVER_SOURCES_A) $(FBDEV_DRIVER_SOURCES) +else +STAND_ALONE_DRIVER_SOURCES = $(STAND_ALONE_DRIVER_SOURCES_A) $(X11_DRIVER_SOURCES) +endif STAND_ALONE_DRIVER_OBJECTS = $(STAND_ALONE_DRIVER_SOURCES:.c=.o) @@ -133,6 +136,7 @@ ALL_SOURCES = \ $(X86_SOURCES) \ $(COMMON_DRIVER_SOURCES)\ $(X11_DRIVER_SOURCES) \ + $(FBDEV_DRIVER_SOURCES) \ $(OSMESA_DRIVER_SOURCES) diff --git a/src/mesa/drivers/fbdev/glfbdev.c b/src/mesa/drivers/fbdev/glfbdev.c index 21b6165bb1..3a6b452065 100644 --- a/src/mesa/drivers/fbdev/glfbdev.c +++ b/src/mesa/drivers/fbdev/glfbdev.c @@ -152,8 +152,8 @@ static void get_buffer_size( GLframebuffer *buffer, GLuint *width, GLuint *height ) { const GLFBDevBufferPtr fbdevbuffer = GLFBDEV_BUFFER(buffer); - *width = fbdevbuffer->var.xres_virtual; - *height = fbdevbuffer->var.yres_virtual; + *width = fbdevbuffer->var.xres; + *height = fbdevbuffer->var.yres; } @@ -389,43 +389,37 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo, blueBits = varInfo->blue.length; alphaBits = varInfo->transp.length; - if ((fixInfo->visual == FB_VISUAL_TRUECOLOR || - fixInfo->visual == FB_VISUAL_DIRECTCOLOR) - && varInfo->bits_per_pixel == 24 - && varInfo->red.offset == 16 - && varInfo->green.offset == 8 - && varInfo->blue.offset == 0) { - vis->pixelFormat = PF_B8G8R8; - } - else if ((fixInfo->visual == FB_VISUAL_TRUECOLOR || - fixInfo->visual == FB_VISUAL_DIRECTCOLOR) - && varInfo->bits_per_pixel == 32 - && varInfo->red.offset == 16 - && varInfo->green.offset == 8 - && varInfo->blue.offset == 0 - && varInfo->transp.offset == 24) { - vis->pixelFormat = PF_B8G8R8A8; - } - else if ((fixInfo->visual == FB_VISUAL_TRUECOLOR || - fixInfo->visual == FB_VISUAL_DIRECTCOLOR) - && varInfo->bits_per_pixel == 16 - && varInfo->red.offset == 11 - && varInfo->green.offset == 5 - && varInfo->blue.offset == 0) { - vis->pixelFormat = PF_B5G6R5; - } - else if ((fixInfo->visual == FB_VISUAL_TRUECOLOR || - fixInfo->visual == FB_VISUAL_DIRECTCOLOR) - && 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"); - _mesa_free(vis); - return NULL; + 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"); + _mesa_free(vis); + return NULL; + } } } else { @@ -568,7 +562,7 @@ new_glfbdev_renderbuffer(void *bufferStart, const GLFBDevVisualPtr visual) rb->rowStride = visual->var.xres_virtual * visual->var.bits_per_pixel / 8; rb->bottom = (GLubyte *) bufferStart - + (visual->var.yres_virtual - 1) * rb->rowStride; + + (visual->var.yres - 1) * rb->rowStride; rb->Base.Width = visual->var.xres; rb->Base.Height = visual->var.yres; -- cgit v1.2.3