diff options
| -rw-r--r-- | conf/distro/include/preferred-shr-versions.inc | 1 | ||||
| -rw-r--r-- | recipes/mesa/mesa-dri-7.8.2/fix-progs-makefile.patch (renamed from recipes/mesa/mesa-xlib-7.8/fix-progs-makefile.patch) | 5 | ||||
| -rw-r--r-- | recipes/mesa/mesa-dri-7.8.2/glamo.patch (renamed from recipes/mesa/mesa-dri-7.8.1/glamo.patch) | 0 | ||||
| -rw-r--r-- | recipes/mesa/mesa-dri-7.8/fix-progs-makefile.patch | 81 | ||||
| -rw-r--r-- | recipes/mesa/mesa-dri-7.8/glamo.patch | 2373 | ||||
| -rw-r--r-- | recipes/mesa/mesa-dri-glsl-native_7.8.2.bb (renamed from recipes/mesa/mesa-dri-glsl-native_7.8.bb) | 11 | ||||
| -rw-r--r-- | recipes/mesa/mesa-dri_7.8.2.bb (renamed from recipes/mesa/mesa-dri_7.8.1.bb) | 10 | ||||
| -rw-r--r-- | recipes/mesa/mesa-dri_7.8.bb | 41 | ||||
| -rw-r--r-- | recipes/mesa/mesa-xlib-7.8.2/fix-progs-makefile.patch (renamed from recipes/mesa/mesa-dri-7.8.1/fix-progs-makefile.patch) | 0 | ||||
| -rw-r--r-- | recipes/mesa/mesa-xlib_7.8.2.bb (renamed from recipes/mesa/mesa-xlib_7.8.bb) | 0 | ||||
| -rw-r--r-- | recipes/mesa/mesa_7.8.2.bb (renamed from recipes/mesa/mesa_7.8.bb) | 0 |
11 files changed, 13 insertions, 2509 deletions
diff --git a/conf/distro/include/preferred-shr-versions.inc b/conf/distro/include/preferred-shr-versions.inc index 168989bc5a..30ff61e3c6 100644 --- a/conf/distro/include/preferred-shr-versions.inc +++ b/conf/distro/include/preferred-shr-versions.inc @@ -9,7 +9,6 @@ PREFERRED_VERSION_automake-native = "1.11.1" PREFERRED_VERSION_libmikmod = "3.2.0-beta2" PREFERRED_VERSION_mtd-utils-native = "1.2.0+git" PREFERRED_VERSION_strace = "4.5.15" -PREFERRED_VERSION_mesa-dri = "7.8.1" PREFERRED_VERSION_emacs-x11 = "23.1" # We need this for jamvm diff --git a/recipes/mesa/mesa-xlib-7.8/fix-progs-makefile.patch b/recipes/mesa/mesa-dri-7.8.2/fix-progs-makefile.patch index 40e6a1b16e..f05d4b0519 100644 --- a/recipes/mesa/mesa-xlib-7.8/fix-progs-makefile.patch +++ b/recipes/mesa/mesa-dri-7.8.2/fix-progs-makefile.patch @@ -71,8 +71,9 @@ index f866a32..c0f4e06 100644 # Add X11 and pthread libs to satisfy GNU gold. APP_LIB_DEPS += -lX11 -lpthread --LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(libdir) $(APP_LIB_DEPS) -+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(libdir) -lstdc++ $(APP_LIB_DEPS) +-LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) $(APP_LIB_DEPS) ++LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lstdc++ $(APP_LIB_DEPS) + PROGS = \ corender \ diff --git a/recipes/mesa/mesa-dri-7.8.1/glamo.patch b/recipes/mesa/mesa-dri-7.8.2/glamo.patch index 52b4f3fa69..52b4f3fa69 100644 --- a/recipes/mesa/mesa-dri-7.8.1/glamo.patch +++ b/recipes/mesa/mesa-dri-7.8.2/glamo.patch diff --git a/recipes/mesa/mesa-dri-7.8/fix-progs-makefile.patch b/recipes/mesa/mesa-dri-7.8/fix-progs-makefile.patch deleted file mode 100644 index 40e6a1b16e..0000000000 --- a/recipes/mesa/mesa-dri-7.8/fix-progs-makefile.patch +++ /dev/null @@ -1,81 +0,0 @@ -From e03daf13a562414f07230c17998edd39564b5f1b Mon Sep 17 00:00:00 2001 -From: Martin Jansa <Martin.Jansa@gmail.com> -Date: Thu, 4 Mar 2010 14:16:27 +0100 -Subject: [PATCH] fix libs - ---- - progs/demos/Makefile | 2 +- - progs/glsl/Makefile | 2 +- - progs/redbook/Makefile | 2 +- - progs/samples/Makefile | 2 +- - progs/xdemos/Makefile | 2 +- - 5 files changed, 5 insertions(+), 5 deletions(-) - -diff --git a/progs/demos/Makefile b/progs/demos/Makefile -index 5b1d2a0..121b862 100644 ---- a/progs/demos/Makefile -+++ b/progs/demos/Makefile -@@ -8,7 +8,7 @@ INCDIR = $(TOP)/include - LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \ - $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) - --LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) \ -+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lstdc++ \ - $(APP_LIB_DEPS) - - PROGS = \ -diff --git a/progs/glsl/Makefile b/progs/glsl/Makefile -index 3b5a595..836c4ac 100644 ---- a/progs/glsl/Makefile -+++ b/progs/glsl/Makefile -@@ -10,7 +10,7 @@ LIB_DEP = \ - $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) \ - $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) - --LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) \ -+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -lstdc++ \ - -l$(GL_LIB) $(APP_LIB_DEPS) - - # using : to avoid APP_CC pointing to CC loop -diff --git a/progs/redbook/Makefile b/progs/redbook/Makefile -index b41e488..95ed746 100644 ---- a/progs/redbook/Makefile -+++ b/progs/redbook/Makefile -@@ -7,7 +7,7 @@ INCDIR = $(TOP)/include - - LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) - --LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) -+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lstdc++ $(APP_LIB_DEPS) - - PROGS = aaindex \ - aapoly \ -diff --git a/progs/samples/Makefile b/progs/samples/Makefile -index 64fa47a..9f72c8b 100644 ---- a/progs/samples/Makefile -+++ b/progs/samples/Makefile -@@ -7,7 +7,7 @@ INCDIR = $(TOP)/include - - LIB_DEP = $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLU_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLUT_LIB_NAME) - --LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) $(APP_LIB_DEPS) -+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GLUT_LIB) -l$(GLEW_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lstdc++ $(APP_LIB_DEPS) - - PROGS = accum bitmap1 bitmap2 blendeq blendxor copy cursor depth eval fog \ - font line logo nurb olympic overlay point prim rgbtoppm quad select \ -diff --git a/progs/xdemos/Makefile b/progs/xdemos/Makefile -index f866a32..c0f4e06 100644 ---- a/progs/xdemos/Makefile -+++ b/progs/xdemos/Makefile -@@ -11,7 +11,7 @@ - # Add X11 and pthread libs to satisfy GNU gold. - APP_LIB_DEPS += -lX11 -lpthread - --LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(libdir) $(APP_LIB_DEPS) -+LIBS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L$(libdir) -lstdc++ $(APP_LIB_DEPS) - - PROGS = \ - corender \ --- -1.7.0 - diff --git a/recipes/mesa/mesa-dri-7.8/glamo.patch b/recipes/mesa/mesa-dri-7.8/glamo.patch deleted file mode 100644 index cc55c8b91e..0000000000 --- a/recipes/mesa/mesa-dri-7.8/glamo.patch +++ /dev/null @@ -1,2373 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index 61487c3..c4952bf 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -125,6 +125,9 @@ dnl Add flags for gcc and g++ - if test "x$GCC" = xyes; then - CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -std=c99 -ffast-math" - -+ # Work around GCC bug #39501 -+ CFLAGS="$CFLAGS -fno-finite-math-only" -+ - # Enable -fvisibility=hidden if using a gcc that supports it - save_CFLAGS="$CFLAGS" - AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden]) -@@ -138,6 +141,9 @@ fi - if test "x$GXX" = xyes; then - CXXFLAGS="$CXXFLAGS -Wall" - -+ # Work around GCC bug #39501 -+ CXXFLAGS="$CXXFLAGS -fno-finite-math-only" -+ - # Work around aliasing bugs - developers should comment this out - CXXFLAGS="$CXXFLAGS -fno-strict-aliasing" - fi -diff --git a/src/mesa/drivers/dri/glamo/Makefile b/src/mesa/drivers/dri/glamo/Makefile -new file mode 100644 -index 0000000..e77193d ---- /dev/null -+++ b/src/mesa/drivers/dri/glamo/Makefile -@@ -0,0 +1,22 @@ -+# src/mesa/drivers/dri/glamo/Makefile -+ -+TOP = ../../../../.. -+include $(TOP)/configs/current -+ -+LIBNAME = glamo_dri.so -+ -+DRIVER_SOURCES = \ -+ glamo_screen.c glamo_context.c glamo_state.c glamo_fbo.c glamo_tris.c \ -+ glamo_cmdq.c glamo_render.c -+ -+C_SOURCES = \ -+ $(COMMON_SOURCES) \ -+ $(DRIVER_SOURCES) -+ -+ASM_SOURCES = -+ -+DRI_LIB_DEPS += -ldrm_glamo -+ -+include ../Makefile.template -+ -+symlinks: -diff --git a/src/mesa/drivers/dri/glamo/glamo_cmdq.c b/src/mesa/drivers/dri/glamo/glamo_cmdq.c -new file mode 100644 -index 0000000..1334f8e ---- /dev/null -+++ b/src/mesa/drivers/dri/glamo/glamo_cmdq.c -@@ -0,0 +1,110 @@ -+/* -+ * Command queue submission via DRM -+ * -+ * Copyright 2009 Thomas White <taw@bitwiz.org.uk> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program 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 General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+ -+#include <stdint.h> -+#include <stdlib.h> -+#include <drm.h> -+#include <glamo_drm.h> -+#include <glamo_bo.h> -+ -+#include "glamo_context.h" -+#include "glamo_cmdq.h" -+ -+ -+/* Submit the prepared command sequence to the kernel */ -+void glamoDRMDispatch(glamoContext *gCtx) -+{ -+ drm_glamo_cmd_burst_t burst; -+ int r; -+ -+ burst.base = gCtx->cmd_burst_base; -+ burst.data = gCtx->cmdq_drm; -+ burst.bufsz = gCtx->cmdq_drm_used * 2; /* -> bytes */ -+ burst.nobjs = gCtx->cmdq_obj_used; -+ burst.objs = gCtx->cmdq_objs; -+ burst.obj_pos = gCtx->cmdq_obj_pos; -+ -+ r = drmCommandWrite(gCtx->drm_fd, DRM_GLAMO_CMDBURST, -+ &burst, sizeof(burst)); -+ if ( r != 0 ) { -+ fprintf(stderr, "DRM_GLAMO_CMDBURST failed\n"); -+ } -+ -+ /* Reset counts to zero for the next sequence */ -+ gCtx->cmdq_obj_used = 0; -+ gCtx->cmdq_drm_used = 0; -+} -+ -+ -+void glamoDRMAddData(glamoContext *gCtx, uint32_t val, int len) -+{ -+ if ( gCtx->cmdq_drm_used+4 > gCtx->cmdq_drm_size ) { -+ fprintf(stderr, "Burst command too large\n"); -+ return; -+ } -+ -+ /* Record command */ -+ if ( len == 2 ) { -+ gCtx->cmdq_drm[gCtx->cmdq_drm_used++] = val & 0xffff; -+ } else if ( len == 4 ) { -+ gCtx->cmdq_drm[gCtx->cmdq_drm_used++] = val & 0x0000ffff; -+ gCtx->cmdq_drm[gCtx->cmdq_drm_used++] = val & 0xffff0000; -+ } else { -+ fprintf(stderr, "Wrong command length!\n"); -+ } -+} -+ -+ -+void glamoDRMAddBO(glamoContext *gCtx, struct glamo_bo *bo) -+{ -+ if ( gCtx->cmdq_drm_used+4 > gCtx->cmdq_drm_size ) { -+ fprintf(stderr, "Burst command too large\n"); -+ return; -+ } -+ -+ /* Record object position */ -+ gCtx->cmdq_objs[gCtx->cmdq_obj_used] = bo->handle; -+ /* -> bytes */ -+ gCtx->cmdq_obj_pos[gCtx->cmdq_obj_used] = gCtx->cmdq_drm_used * 2; -+ gCtx->cmdq_obj_used++; -+ -+ /* Record command */ -+ gCtx->cmdq_drm[gCtx->cmdq_drm_used++] = 0x0000; -+ gCtx->cmdq_drm[gCtx->cmdq_drm_used++] = 0x0000; -+} -+ -+ -+void glamoDRMStartBurst(glamoContext *gCtx, uint16_t base) -+{ -+ gCtx->cmd_burst_base = base; -+} -+ -+ -+void glamoInitCmdqCache(glamoContext *gCtx) -+{ -+ gCtx->cmdq_objs = malloc(1024); -+ gCtx->cmdq_obj_pos = malloc(1024); -+ gCtx->cmdq_obj_used = 0; -+ gCtx->cmdq_drm_used = 0; -+ gCtx->cmdq_drm_size = 4 * 1024; -+ gCtx->cmdq_drm = malloc(gCtx->cmdq_drm_size); -+} -diff --git a/src/mesa/drivers/dri/glamo/glamo_cmdq.h b/src/mesa/drivers/dri/glamo/glamo_cmdq.h -new file mode 100644 -index 0000000..7420d7b ---- /dev/null -+++ b/src/mesa/drivers/dri/glamo/glamo_cmdq.h -@@ -0,0 +1,33 @@ -+/* -+ * Command queue submission via DRM -+ * -+ * Copyright 2009 Thomas White <taw@bitwiz.org.uk> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of -+ * the License, or (at your option) any later version. -+ * -+ * This program 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 General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software -+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, -+ * MA 02111-1307 USA -+ */ -+ -+ -+#include <stdint.h> -+#include <glamo_bo.h> -+ -+#include "glamo_context.h" -+ -+ -+extern void glamoDRMDispatch(glamoContext *gCtx); -+extern void glamoDRMAddBO(glamoContext *gCtx, struct glamo_bo *bo); -+extern void glamoDRMAddData(glamoContext *gCtx, uint32_t val, int len); -+extern void glamoDRMStartBurst(glamoContext *gCtx, uint16_t base); -+extern void glamoInitCmdqCache(glamoContext *gCtx); -diff --git a/src/mesa/drivers/dri/glamo/glamo_context.c b/src/mesa/drivers/dri/glamo/glamo_context.c -new file mode 100644 -index 0000000..527654f ---- /dev/null -+++ b/src/mesa/drivers/dri/glamo/glamo_context.c -@@ -0,0 +1,360 @@ -+/* -+ * Direct Rendering Support for SMedia Glamo 336x/337x -+ * -+ * (c) 2009 Thomas White <taw@bitwiz.org.uk> -+ * Roughly based on sis_context.c (c) 2003 Eric Anholt -+ * and radeon_common_context.c -+ * -+ * 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 -+ * THE AUTHORS 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 "dri_util.h" -+#include "drirenderbuffer.h" -+#include "utils.h" -+ -+#include "swrast/swrast.h" -+#include "swrast_setup/swrast_setup.h" -+#include "drivers/common/driverfuncs.h" -+#include "vbo/vbo.h" -+#include "tnl/tnl.h" -+#include "tnl/t_pipeline.h" -+#include "main/state.h" -+ -+#include "glamo_context.h" -+#include "glamo_screen.h" -+#include "glamo_state.h" -+#include "glamo_fbo.h" -+#include "glamo_tris.h" -+#include "glamo_render.h" -+#include "glamo_cmdq.h" -+ -+#include <glamo_bo.h> -+#include <glamo_bo_gem.h> -+#include <glamo_drm.h> -+ -+ -+#define DRIVER_DATE "20090913" -+ -+ -+static inline struct glamo_renderbuffer *glamo_get_renderbuffer( -+ struct gl_framebuffer *fb, -+ int att_index) -+{ -+ if ( att_index >= 0 ) { -+ struct glamo_renderbuffer *gr; -+ gr = glamo_renderbuffer(fb->Attachment[att_index].Renderbuffer); -+ return gr; -+ } else { -+ return NULL; -+ } -+} -+ -+ -+static const GLubyte *glamoGetString(GLcontext *ctx, GLenum name) -+{ -+ static char buffer[128]; -+ -+ switch (name) { -+ case GL_VENDOR: -+ return (GLubyte *)"Thomas White"; -+ case GL_RENDERER: { -+ driGetRendererString(buffer, "Glamo", DRIVER_DATE, 0); -+ return (GLubyte *) buffer; -+ } -+ default: -+ return 0; -+ } -+} -+ -+ -+/* Called when Mesa needs to know the size of the framebuffer */ -+static void glamoBufferSize(GLframebuffer *buffer, -+ GLuint *width, GLuint *height) -+{ -+ GET_CURRENT_CONTEXT(ctx); -+ glamoContextPtr glamo = GLAMO_CONTEXT(ctx); -+ -+ *width = glamo->driDrawable->w; -+ *height = glamo->driDrawable->h; -+} -+ -+ -+GLboolean glamoCreateContext(const __GLcontextModes *glVisual, -+ __DRIcontext *driContextPriv, -+ void *sharedContextPrivate) -+{ -+ GLcontext *ctx, *shareCtx; -+ __DRIscreen *sPriv = driContextPriv->driScreenPriv; -+ glamoContextPtr context; -+ glamoScreenPtr glamoScreen; -+ struct dd_function_table functions; -+ -+ context = (glamoContextPtr)CALLOC(sizeof(*context)); -+ if ( context == NULL ) return GL_FALSE; -+ -+ _mesa_init_driver_functions(&functions); -+ -+ /* Allocate the Mesa context */ -+ if ( sharedContextPrivate ) -+ shareCtx = ((glamoContextPtr)sharedContextPrivate)->glCtx; -+ else -+ shareCtx = NULL; -+ context->glCtx = _mesa_create_context(glVisual, shareCtx, -+ &functions, (void *)context); -+ if ( context->glCtx == NULL ) { -+ FREE(context); -+ return GL_FALSE; -+ } -+ driContextPriv->driverPrivate = context; -+ ctx = context->glCtx; -+ -+ glamoScreen = context->glamoScreen = (glamoScreenPtr)sPriv->private; -+ -+ ctx->Driver.GetString = glamoGetString; -+ ctx->Driver.GetBufferSize = glamoBufferSize; -+ -+ context->driContext = driContextPriv; -+ context->driScreen = sPriv; -+ context->driDrawable = NULL; -+ context->drm_fd = sPriv->fd; -+ -+ /* Initialize the software rasterizer and helper modules. */ -+ _swrast_CreateContext(ctx); -+ _vbo_CreateContext(ctx); -+ _tnl_CreateContext(ctx); -+ _swsetup_CreateContext(ctx); -+ -+ /* Install our pipeline (see glamo_render.c) */ -+ _tnl_install_pipeline(ctx, glamo_pipeline); -+ -+ _swrast_allow_pixel_fog(ctx, GL_TRUE); -+ _swrast_allow_vertex_fog(ctx, GL_FALSE); -+ _tnl_allow_pixel_fog(ctx, GL_TRUE); -+ _tnl_allow_vertex_fog(ctx, GL_FALSE); -+ -+ glamoInitCmdqCache(context); -+ glamoInitStateFuncs(ctx); -+ glamoInitTriFuncs(ctx); -+ -+ return GL_TRUE; -+} -+ -+ -+void glamoDestroyContext(__DRIcontext *driContextPriv) -+{ -+ glamoContextPtr context; -+ -+ context = (glamoContextPtr)driContextPriv->driverPrivate; -+ assert(context != NULL); -+ -+ if ( context != NULL ) { -+ -+ _swsetup_DestroyContext(context->glCtx); -+ _tnl_DestroyContext(context->glCtx); -+ _vbo_DestroyContext(context->glCtx); -+ _swrast_DestroyContext(context->glCtx); -+ -+ _mesa_destroy_context(context->glCtx); -+ -+ } -+ -+ FREE(context); -+} -+ -+ -+void glamo_update_renderbuffers(__DRIcontext *context, -+ __DRIdrawable *drawable) -+{ -+ unsigned int attachments[10]; -+ __DRIbuffer *buffers; -+ __DRIscreen *screen; -+ int i, count; -+ struct glamo_framebuffer *draw; -+ glamoContextPtr glamo; -+ struct glamo_bo *bo; -+ -+ draw = drawable->driverPrivate; -+ screen = context->driScreenPriv; -+ glamo = (glamoContextPtr)context->driverPrivate; -+ i = 0; -+ if ( draw->color_rb[0] ) { -+ attachments[i++] = __DRI_BUFFER_FRONT_LEFT; -+ } -+ if ( draw->color_rb[1] ) { -+ attachments[i++] = __DRI_BUFFER_BACK_LEFT; -+ } -+ -+ buffers = screen->dri2.loader->getBuffers(drawable, -+ &drawable->w, -+ &drawable->h, -+ attachments, i, -+ &count, -+ drawable->loaderPrivate); -+ if ( buffers == NULL ) return; -+ -+ /* Set one cliprect to cover the whole drawable */ -+ drawable->x = 0; -+ drawable->y = 0; -+ drawable->backX = 0; -+ drawable->backY = 0; -+ drawable->numClipRects = 1; -+ drawable->pClipRects[0].x1 = 0; -+ drawable->pClipRects[0].y1 = 0; -+ drawable->pClipRects[0].x2 = drawable->w; -+ drawable->pClipRects[0].y2 = drawable->h; -+ drawable->numBackClipRects = 1; -+ drawable->pBackClipRects[0].x1 = 0; -+ drawable->pBackClipRects[0].y1 = 0; -+ drawable->pBackClipRects[0].x2 = drawable->w; -+ drawable->pBackClipRects[0].y2 = drawable->h; -+ -+ /* For each attachment */ -+ for ( i=0; i<count; i++ ) { -+ -+ struct glamo_renderbuffer *grb; -+ -+ switch ( buffers[i].attachment ) { -+ case __DRI_BUFFER_FRONT_LEFT: -+ grb = draw->color_rb[0]; -+ break; -+ case __DRI_BUFFER_BACK_LEFT: -+ grb = draw->color_rb[1]; -+ break; -+ case __DRI_BUFFER_DEPTH: -+ grb = glamo_get_renderbuffer(&draw->base, BUFFER_DEPTH); -+ break; -+ case __DRI_BUFFER_STENCIL: -+ grb = glamo_get_renderbuffer(&draw->base, -+ BUFFER_STENCIL); -+ break; -+ case __DRI_BUFFER_FAKE_FRONT_LEFT: -+ grb = draw->color_rb[0]; -+ break; -+ case __DRI_BUFFER_ACCUM: -+ default: -+ fprintf(stderr, -+ "Unhandled buffer attach event," -+ " attachment type %d\n", buffers[i].attachment); -+ return; -+ } -+ -+ if ( grb == NULL ) { -+ /* Don't know how to handle this type of buffer */ -+ continue; -+ } -+ -+ if ( grb->bo ) { -+ uint32_t name = glamo_gem_get_name(grb->bo); -+ if ( name == buffers[i].name ) { -+ /* Buffer already attached. No action needed */ -+ continue; -+ } -+ } -+ -+ grb->cpp = buffers[i].cpp; -+ grb->pitch = buffers[i].pitch; -+ grb->width = drawable->w; -+ grb->height = drawable->h; -+ -+ bo = glamo_bo_open(glamo->glamoScreen->bom, buffers[i].name, -+ 0, 0, GLAMO_GEM_DOMAIN_VRAM, -+ buffers[i].flags); -+ if ( bo == NULL ) { -+ fprintf(stderr, "Failed to attach buffer %d\n", -+ buffers[i].name); -+ } -+ -+ glamo_renderbuffer_set_bo(grb, bo); -+ glamo_bo_unref(bo); -+ -+ } -+ -+ driUpdateFramebufferSize(glamo->glCtx, drawable); -+} -+ -+ -+GLboolean glamoMakeCurrent(__DRIcontext *driContextPriv, -+ __DRIdrawable *driDrawPriv, -+ __DRIdrawable *driReadPriv) -+{ -+ struct glamo_framebuffer *draw_fb; -+ struct gl_framebuffer *read_fb; -+ glamoContextPtr glamo; -+ -+ if ( driContextPriv == NULL ) { -+ _mesa_make_current(NULL, NULL, NULL); -+ return GL_TRUE; -+ } -+ -+ /* The Glamo context we're switching to */ -+ glamo = (glamoContextPtr)driContextPriv->driverPrivate; -+ -+ glamo->driDrawable = driDrawPriv; -+ -+ /* These two will probably be the same */ -+ draw_fb = (struct glamo_framebuffer *)driDrawPriv->driverPrivate; -+ read_fb = (struct gl_framebuffer *)driReadPriv->driverPrivate; -+ -+ glamo_update_renderbuffers(driContextPriv, driDrawPriv); -+ if (driDrawPriv != driReadPriv) -+ glamo_update_renderbuffers(driContextPriv, driReadPriv); -+ -+ _mesa_make_current(glamo->glCtx, &draw_fb->base, read_fb); -+ _mesa_update_state(glamo->glCtx); -+ -+ return GL_TRUE; -+} -+ -+ -+GLboolean glamoUnbindContext(__DRIcontext *driContextPriv) -+{ -+ return GL_TRUE; -+} -+ -+ -+/* Convert IEEE754 32-bit float to Glamo's signed 24-bit float */ -+uint32_t float7s16(GLfloat in) -+{ -+ uint32_t a, b; -+ uint32_t sign, expo, mant; /* Sign, exponent, significand */ -+ -+ a = *(uint32_t *)∈ -+ -+ /* This is bad */ -+ if ( a & 0x40000000 ) { -+ printf(stderr, "Warning: Exponent won't fit into 7 bits\n"); -+ } -+ -+ /* This hopefully isn't a big problem */ -+ if ( a & 0x0000007f ) { -+ printf(stderr, "Warning: Precision lost in FP conversion\n"); -+ } -+ -+ /* Separate out the right bits */ -+ mant = a & 0x007fff80; /* Bits 7-22 (bits 0-6 are lost) */ -+ expo = a & 0x3f800000; /* Bits 23-29 (bit 30 is lost) */ -+ sign = a & 0x80000000; /* Bit 31 */ -+ -+ /* Shift and recombine */ -+ b = sign >> 8; /* Fills bit 23 */ -+ b |= expo >> 7; /* Fills bits 16-22 */ -+ b |= mant >> 7; /* Fills bits 0-15 */ -+ -+ return b; -+} -diff --git a/src/mesa/drivers/dri/glamo/glamo_context.h b/src/mesa/drivers/dri/glamo/glamo_context.h -new file mode 100644 -index 0000000..ccce29c ---- /dev/null -+++ b/src/mesa/drivers/dri/glamo/glamo_context.h -@@ -0,0 +1,106 @@ -+/* -+ * Direct Rendering Support for SMedia Glamo 336x/337x -+ * -+ * (c) 2009 Thomas White <taw@bitwiz.org.uk> -+ * Roughly based on sis_context.h (c) 2003 Eric Anholt -+ * -+ * 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 -+ * THE AUTHORS 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. -+ */ -+ -+#ifndef __GLAMO_CONTEXT_H -+#define __GLAMO_CONTEXT_H -+ -+ -+#include "dri_util.h" -+#include "utils.h" -+#include "tnl/t_vertex.h" -+ -+#include "glamo_screen.h" -+ -+ -+typedef struct glamo_context glamoContext; -+typedef struct glamo_context *glamoContextPtr; -+ -+struct glamo_context { -+ -+ GLcontext *glCtx; /* Must be first in this structure */ -+ -+ int drm_fd; /* DRM fd */ -+ -+ __DRIcontext *driContext; /* DRI context */ -+ __DRIscreen *driScreen; /* DRI screen */ -+ __DRIdrawable *driDrawable; /* DRI drawable bound to this ctx */ -+ -+ glamoScreenPtr glamoScreen; /* Screen private DRI data */ -+ -+ driOptionCache optionCache; -+ -+ uint16_t *cmdq_drm; /* Command queue cache */ -+ uint16_t cmd_burst_base; -+ int cmdq_drm_used; -+ int cmdq_drm_size; -+ int cmdq_obj_used; -+ uint32_t *cmdq_objs; -+ unsigned int *cmdq_obj_pos; -+ -+ /* Information about the current primitive */ -+ struct { -+ GLuint id; -+ uint32_t primitive; /* Current hardware primitive type */ -+ struct glamo_bo *vb_bo; -+ uint8_t *vb; -+ unsigned int start_offset; /* Byte offset of start */ -+ unsigned int current_offset; /* Byte offset of next vertex */ -+ unsigned int count; /* Number of vertices */ -+ } prim; -+ -+ /* Current vertex format and attributes */ -+ int vertex_size; -+ struct tnl_attr_map vertex_attrs[VERT_ATTRIB_MAX]; -+ -+ /* State */ -+ GLuint new_state; /* State which must be updated */ -+ uint16_t col_clear; -+ -+}; -+ -+#define GLAMO_CONTEXT(ctx) ((glamoContextPtr)(ctx->DriverCtx)) -+ -+#define TAG(x) glamo##x -+#include "tnl_dd/t_dd_vertex.h" -+#undef TAG -+ -+extern GLboolean glamoCreateContext(const __GLcontextModes *glVis, -+ __DRIcontext *driContextPriv, -+ void *sharedContextPrivate); -+extern void glamoDestroyContext(__DRIcontext *dcp); -+extern GLboolean glamoMakeCurrent(__DRIcontext *driContextPriv, -+ __DRIdrawable *driDrawPriv, -+ __DRIdrawable *driReadPriv); -+extern GLboolean glamoUnbindContext(__DRIcontext *driContextPriv); -+extern void glamo_update_renderbuffers(__DRIcontext *context, -+ __DRIdrawable *drawable); -+ -+#define GLAMO_PACKCOLOR565(r, g, b) \ -+ ((((r) & 0xf8) << 8) \ -+ | (((g) & 0xfc) << 3) \ -+ | (((b) & 0xf8) >> 3)) -+ -+extern uint32_t float7s16(GLfloat in); -+ -+#endif /* __GLAMO_CONTEXT_H */ -diff --git a/src/mesa/drivers/dri/glamo/glamo_fbo.c b/src/mesa/drivers/dri/glamo/glamo_fbo.c -new file mode 100644 -index 0000000..c866d21 ---- /dev/null -+++ b/src/mesa/drivers/dri/glamo/glamo_fbo.c -@@ -0,0 +1,130 @@ -+/* -+ * Direct Rendering Support for SMedia Glamo 336x/337x -+ * -+ * (c) 2009 Thomas White <taw@bitwiz.org.uk> -+ * Roughly based on radeon_fbo.c (c) 2008 Red Hat Inc -+ * -+ * 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 -+ * THE AUTHORS 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 "main/imports.h" -+#include "main/macros.h" -+#include "main/mtypes.h" -+#include "main/formats.h" -+#include "main/fbobject.h" -+#include "main/framebuffer.h" -+#include "main/renderbuffer.h" -+#include "main/context.h" -+#include "dri_util.h" -+ -+/* This comes from libdrm_glamo */ -+#include <glamo_bo.h> -+ -+#include "glamo_fbo.h" -+ -+ -+static void glamo_delete_renderbuffer(struct gl_renderbuffer *rb) -+{ -+ struct glamo_renderbuffer *grb = glamo_renderbuffer(rb); -+ -+ ASSERT(grb); -+ -+ if ( grb && grb->bo ) { -+ glamo_bo_unref(grb->bo); -+ } -+ _mesa_free(grb); -+} -+ -+ -+static void *glamo_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, -+ GLint x, GLint y) -+{ -+ return NULL; /* Can't be directly addressed */ -+} -+ -+ -+/* Called for each hardware renderbuffer when a _window_ is resized. -+ * Just update fields. -+ * Not used for user-created renderbuffers! -+ */ -+static GLboolean glamo_alloc_window_storage(GLcontext *ctx, -+ struct gl_renderbuffer *rb, -+ GLenum internalFormat, -+ GLuint width, GLuint height) -+{ -+ ASSERT(rb->Name == 0); -+ rb->Width = width; -+ rb->Height = height; -+ rb->Format = internalFormat; -+ return GL_TRUE; -+} -+ -+ -+/* Create a buffer, such as a colour or depth buffer */ -+struct glamo_renderbuffer *glamo_create_renderbuffer(GLenum format, -+ __DRIdrawable *driDrawPriv) -+{ -+ struct glamo_renderbuffer *grb; -+ -+ grb = CALLOC_STRUCT(glamo_renderbuffer); -+ if ( !grb ) return NULL; -+ -+ _mesa_init_renderbuffer(&grb->base, 0); -+ grb->base.ClassID = GLAMO_RB_CLASS; -+ -+ switch (format) { -+ case GL_RGB5: -+ grb->base.Format = MESA_FORMAT_RGB565; -+ grb->base._BaseFormat = GL_RGB; -+ -+ grb->base.DataType = GL_UNSIGNED_BYTE; -+ break; -+ case GL_DEPTH_COMPONENT16: -+ grb->base.DataType = GL_UNSIGNED_SHORT; -+ grb->base._BaseFormat = GL_DEPTH_COMPONENT; -+ break; -+ default: -+ fprintf(stderr, "%s: Unknown format 0x%04x\n", __FUNCTION__, format); -+ _mesa_delete_renderbuffer(&grb->base); -+ return NULL; -+ } -+ -+ grb->dPriv = driDrawPriv; -+ grb->base.InternalFormat = format; -+ -+ grb->base.Delete = glamo_delete_renderbuffer; -+ grb->base.AllocStorage = glamo_alloc_window_storage; -+ grb->base.GetPointer = glamo_get_pointer; -+ -+ return grb; -+} -+ -+ -+void glamo_renderbuffer_set_bo(struct glamo_renderbuffer *grb, -+ struct glamo_bo *bo) -+{ -+ struct glamo_bo *old; -+ old = grb->bo; -+ grb->bo = bo; -+ glamo_bo_ref(bo); -+ if ( old ) glamo_bo_unref(old); -+} -+ -+ -+/* kate: space-indent on; indent-width 3; mixedindent off; indent-mode cstyle; */ -diff --git a/src/mesa/drivers/dri/glamo/glamo_fbo.h b/src/mesa/drivers/dri/glamo/glamo_fbo.h -new file mode 100644 -index 0000000..48210dd ---- /dev/null -+++ b/src/mesa/drivers/dri/glamo/glamo_fbo.h -@@ -0,0 +1,77 @@ -+/* -+ * Direct Rendering Support for SMedia Glamo 336x/337x -+ * -+ * (c) 2009 Thomas White <taw@bitwiz.org.uk> -+ * -+ * 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 -+ * THE AUTHORS 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. -+ */ -+ -+#ifndef __GLAMO_FBO_H -+#define __GLAMO_FBO_H -+ -+ -+#include "main/mtypes.h" -+#include "dri_util.h" -+ -+ -+/* This is just a marker so we can tell a Glamo renderbuffer from a Mesa one */ -+#define GLAMO_RB_CLASS (0xdeadbeef) -+ -+ -+struct glamo_renderbuffer -+{ -+ struct gl_renderbuffer base; /* Must be first */ -+ struct glamo_bo *bo; -+ unsigned int cpp; -+ unsigned int pitch; -+ unsigned int width; -+ unsigned int height; -+ |
