summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configs/linux-fbdev10
-rw-r--r--src/glut/fbdev/Makefile30
-rw-r--r--src/glut/fbdev/bitmap.c78
-rw-r--r--src/glut/fbdev/colormap.c15
-rw-r--r--src/glut/fbdev/cursor.c11
-rw-r--r--src/glut/fbdev/fbdev.c13
-rw-r--r--src/glut/fbdev/stroke.c81
-rw-r--r--src/glut/mini/teapot.c2
-rw-r--r--src/mesa/Makefile16
-rw-r--r--src/mesa/drivers/fbdev/glfbdev.c74
10 files changed, 256 insertions, 74 deletions
diff --git a/configs/linux-fbdev b/configs/linux-fbdev
index d1aeda555ef..3ab6b69c39c 100644
--- a/configs/linux-fbdev
+++ b/configs/linux-fbdev
@@ -3,12 +3,14 @@
include $(TOP)/configs/linux
CONFIG_NAME = linux-fbdev
-DRIVER_DIRS = fbdev osmesa
-SRC_DIRS = mesa glu glut/fbdev glw
-CFLAGS = -g -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DUSE_XSHM -DPTHREADS -DUSE_GLFBDEV_DRIVER
+CFLAGS = -O3 -ffast-math -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE -DPTHREADS -DUSE_GLFBDEV_DRIVER
+SRC_DIRS = mesa glu glut/fbdev
+DRIVER_DIRS = fbdev
+PROGRAM_DIRS = fbdev demos redbook samples
+
+GL_LIB_DEPS = $(EXTRA_LIB_PATH) -lm -lpthread
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) $(EXTRA_LIB_PATH) -lgpm -lm
-PROGRAM_DIRS = fbdev demos redbook samples
diff --git a/src/glut/fbdev/Makefile b/src/glut/fbdev/Makefile
index 4f70efe2794..11d95665adb 100644
--- a/src/glut/fbdev/Makefile
+++ b/src/glut/fbdev/Makefile
@@ -4,10 +4,10 @@ TOP = ../../..
include $(TOP)/configs/current
GLX_SHARED = $(TOP)/src/glut/glx
-SHAPES = $(TOP)/src/glut/mini
+MINI_SHARED = $(TOP)/src/glut/mini
-GLUT_MAJOR = 5
-GLUT_MINOR = 0
+GLUT_MAJOR = 3
+GLUT_MINOR = 7
GLUT_TINY = 1
INCLUDES = -I$(TOP)/include -I$(GLX_SHARED)
@@ -23,13 +23,13 @@ CORE_SOURCES = \
input.c \
callback.c \
gamemode.c \
- vidresize.c
+ vidresize.c \
+ bitmap.c \
+ stroke.c
GLX_SHARED_SOURCES = \
$(GLX_SHARED)/glut_8x13.c \
$(GLX_SHARED)/glut_9x15.c \
- $(GLX_SHARED)/glut_bwidth.c \
- $(GLX_SHARED)/glut_bitmap.c \
$(GLX_SHARED)/glut_hel10.c \
$(GLX_SHARED)/glut_hel12.c \
$(GLX_SHARED)/glut_hel18.c \
@@ -37,12 +37,12 @@ GLX_SHARED_SOURCES = \
$(GLX_SHARED)/glut_tr24.c \
$(GLX_SHARED)/glut_mroman.c \
$(GLX_SHARED)/glut_roman.c \
- $(GLX_SHARED)/glut_swidth.c \
- $(GLX_SHARED)/glut_stroke.c \
- $(TOP)/src/glut/mini/models.c \
- $(GLX_SHARED)/glut_teapot.c
-SOURCES = $(CORE_SOURCES) $(GLX_SHARED_SOURCES)
+MINI_SHARED_SOURCES = \
+ $(MINI_SHARED)/models.c \
+ $(MINI_SHARED)/teapot.c
+
+SOURCES = $(CORE_SOURCES) $(GLX_SHARED_SOURCES) $(MINI_SHARED_SOURCES)
OBJECTS = $(SOURCES:.c=.o)
@@ -50,7 +50,7 @@ OBJECTS = $(SOURCES:.c=.o)
##### RULES #####
.c.o:
- $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
+ $(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
.S.o:
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $< -o $@
@@ -68,6 +68,12 @@ $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME): depend $(OBJECTS)
$(GLUT_LIB_DEPS) -install $(TOP)/$(LIB_DIR) \
$(MKLIB_OPTIONS) $(OBJECTS)
+install:
+ $(INSTALL) -d $(INSTALL_DIR)/include/GL
+ $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR)
+ $(INSTALL) -m 644 $(TOP)/include/GL/glut.h $(INSTALL_DIR)/include/GL
+ $(COPY_LIBS) $(TOP)/$(LIB_DIR)/libglut* $(INSTALL_DIR)/$(LIB_DIR)
+
# Run 'make -f Makefile.solo dep' to update the dependencies if you change
# what's included by any source file.
depend: $(SOURCES)
diff --git a/src/glut/fbdev/bitmap.c b/src/glut/fbdev/bitmap.c
new file mode 100644
index 00000000000..5dbb330cc24
--- /dev/null
+++ b/src/glut/fbdev/bitmap.c
@@ -0,0 +1,78 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ * Copyright (C) 1995-2006 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * Library for glut using mesa fbdev driver
+ *
+ * Written by Sean D'Epagnier (c) 2006
+ *
+ * To improve on this library, maybe support subwindows or overlays,
+ * I (sean at depagnier dot com) will do my best to help.
+ */
+
+
+#include "glutbitmap.h"
+
+void glutBitmapCharacter(GLUTbitmapFont font, int c)
+{
+ const BitmapCharRec *ch;
+ BitmapFontPtr fi = (BitmapFontPtr) font;
+
+ if (c < fi->first ||
+ c >= fi->first + fi->num_chars)
+ return;
+ ch = fi->ch[c - fi->first];
+ if (!ch)
+ return;
+
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+
+ glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
+ glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+ glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
+ glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
+ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+ glBitmap(ch->width, ch->height, ch->xorig, ch->yorig,
+ ch->advance, 0, ch->bitmap);
+ glPopClientAttrib();
+}
+
+int glutBitmapWidth (GLUTbitmapFont font, int c)
+{
+ const BitmapCharRec *ch;
+ BitmapFontPtr fi = (BitmapFontPtr) font;
+
+ if (c < fi->first || c >= fi->first + fi->num_chars)
+ return 0;
+ ch = fi->ch[c - fi->first];
+ if (ch)
+ return ch->advance;
+ return 0;
+}
+
+int glutBitmapLength(GLUTbitmapFont font, const unsigned char *string)
+{
+ int length = 0;
+
+ for (; *string; string++)
+ length += glutBitmapWidth(font, *string);
+ return length;
+}
diff --git a/src/glut/fbdev/colormap.c b/src/glut/fbdev/colormap.c
index 157296d15c1..4c013c76463 100644
--- a/src/glut/fbdev/colormap.c
+++ b/src/glut/fbdev/colormap.c
@@ -100,8 +100,21 @@ void LoadColorMap(void)
/* we're assuming 256 entries here */
int i;
+ switch(VarInfo.bits_per_pixel) {
+ case 8:
+ case 24:
+ case 32:
+ ColorMap.len = 256;
+ break;
+ case 15:
+ ColorMap.len = 32;
+ break;
+ case 16:
+ ColorMap.len = 64;
+ break;
+ }
+
ColorMap.start = 0;
- ColorMap.len = 256;
ColorMap.red = RedColorMap;
ColorMap.green = GreenColorMap;
ColorMap.blue = BlueColorMap;
diff --git a/src/glut/fbdev/cursor.c b/src/glut/fbdev/cursor.c
index 06ae2d6f54e..e7fb00f46ff 100644
--- a/src/glut/fbdev/cursor.c
+++ b/src/glut/fbdev/cursor.c
@@ -163,7 +163,8 @@ void DrawCursor(void)
cstride /= 2;
for(i = yoff; i < ylen; i++) {
for(j = xoff; j < xlen; j++) {
- e[0] = ((((d[0] + (((int)(((e[0] >> 8) & 0xf8)
+ if(d[3] < 220)
+ e[0] = ((((d[0] + (((int)(((e[0] >> 8) & 0xf8)
| ((c[0] >> 11) & 0x7)) * d[3]) >> 8)) & 0xf8) << 8)
| (((d[1] + (((int)(((e[0] >> 3) & 0xfc)
| ((e[0] >> 5) & 0x3)) * d[3]) >> 8)) & 0xfc) << 3)
@@ -181,9 +182,11 @@ void DrawCursor(void)
case 4:
for(i = yoff; i < ylen; i++) {
for(j = xoff; j < xlen; j++) {
- c[0] = d[0] + (((int)c[0] * d[3]) >> 8);
- c[1] = d[1] + (((int)c[1] * d[3]) >> 8);
- c[2] = d[2] + (((int)c[2] * d[3]) >> 8);
+ if(d[3] < 220) {
+ c[0] = d[0] + (((int)c[0] * d[3]) >> 8);
+ c[1] = d[1] + (((int)c[1] * d[3]) >> 8);
+ c[2] = d[2] + (((int)c[2] * d[3]) >> 8);
+ }
c+=bypp;
d+=4;
diff --git a/src/glut/fbdev/fbdev.c b/src/glut/fbdev/fbdev.c
index ce7d187b66d..10bc6eacc14 100644
--- a/src/glut/fbdev/fbdev.c
+++ b/src/glut/fbdev/fbdev.c
@@ -112,11 +112,8 @@ static void Cleanup(void)
/* close mouse */
CloseMouse();
- glFBDevMakeCurrent( NULL, NULL, NULL);
-
- glFBDevDestroyContext(Context);
- glFBDevDestroyBuffer(Buffer);
- glFBDevDestroyVisual(Visual);
+ if(Visual)
+ glutDestroyWindow(1);
/* restore original variable screen info */
if(FrameBufferFD != -1) {
@@ -735,6 +732,11 @@ int glutGetWindow(void)
void glutDestroyWindow(int win)
{
+ glFBDevMakeCurrent( NULL, NULL, NULL);
+ glFBDevDestroyContext(Context);
+ glFBDevDestroyBuffer(Buffer);
+ glFBDevDestroyVisual(Visual);
+ Visual = NULL;
}
void glutPostRedisplay(void)
@@ -762,6 +764,7 @@ void glutSwapBuffers(void)
Swapping = 0;
}
+ /* if there was a vt switch while swapping, switch now */
if(VTSwitch) {
if(ioctl(ConsoleFD, VT_ACTIVATE, VTSwitch) < 0)
sprintf(exiterror, "Error switching console\n");
diff --git a/src/glut/fbdev/stroke.c b/src/glut/fbdev/stroke.c
new file mode 100644
index 00000000000..1943ac661b1
--- /dev/null
+++ b/src/glut/fbdev/stroke.c
@@ -0,0 +1,81 @@
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.5
+ * Copyright (C) 1995-2006 Brian Paul
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * Library for glut using mesa fbdev driver
+ *
+ * Written by Sean D'Epagnier (c) 2006
+ *
+ * To improve on this library, maybe support subwindows or overlays,
+ * I (sean at depagnier dot com) will do my best to help.
+ */
+
+#include <GL/glut.h>
+#include "glutstroke.h"
+
+void glutStrokeCharacter(GLUTstrokeFont font, int c)
+{
+ const StrokeCharRec *ch;
+ const StrokeRec *stroke;
+ const CoordRec *coord;
+ StrokeFontPtr fontinfo = (StrokeFontPtr) font;
+ int i, j;
+
+ if (c < 0 || c >= fontinfo->num_chars)
+ return;
+ ch = &(fontinfo->ch[c]);
+ if (ch) {
+ for (i = ch->num_strokes, stroke = ch->stroke;
+ i > 0; i--, stroke++) {
+ glBegin(GL_LINE_STRIP);
+ for (j = stroke->num_coords, coord = stroke->coord;
+ j > 0; j--, coord++) {
+ glVertex2f(coord->x, coord->y);
+ }
+ glEnd();
+ }
+ glTranslatef(ch->right, 0.0, 0.0);
+ }
+}
+
+int glutStrokeWidth(GLUTstrokeFont font, int c)
+{
+ StrokeFontPtr fontinfo;
+ const StrokeCharRec *ch;
+
+ fontinfo = (StrokeFontPtr) font;
+
+ if (c < 0 || c >= fontinfo->num_chars)
+ return 0;
+ ch = &(fontinfo->ch[c]);
+ if (ch)
+ return ch->right;
+
+ return 0;
+}
+
+int glutStrokeLength(GLUTstrokeFont font, const unsigned char *string)
+{
+ int length = 0;
+
+ for (; *string; string++)
+ length += glutStrokeWidth(font, *string);
+ return length;
+}
diff --git a/src/glut/mini/teapot.c b/src/glut/mini/teapot.c
index ec2a207763e..aa96fcbbbd6 100644
--- a/src/glut/mini/teapot.c
+++ b/src/glut/mini/teapot.c
@@ -143,7 +143,6 @@ teapot(GLint grid, GLdouble scale, GLenum type)
float p[4][4][3], q[4][4][3], r[4][4][3], s[4][4][3];
long i, j, k, l;
-#if 0
glPushAttrib(GL_ENABLE_BIT | GL_EVAL_BIT);
glEnable(GL_AUTO_NORMAL);
glEnable(GL_NORMALIZE);
@@ -195,7 +194,6 @@ teapot(GLint grid, GLdouble scale, GLenum type)
}
glPopMatrix();
glPopAttrib();
-#endif
}
/* CENTRY */
diff --git a/src/mesa/Makefile b/src/mesa/Makefile
index bf600e0578d..16cf6709ea5 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 21b6165bb14..3a6b452065b 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;