diff options
| author | Sebastian Spaeth <Sebastian@SSpaeth.de> | 2010-03-31 11:35:45 +0200 |
|---|---|---|
| committer | Sebastian Spaeth <Sebastian@SSpaeth.de> | 2010-03-31 11:35:45 +0200 |
| commit | fb3a5d2a5256ffcf88e3cca17c40fe156f6bc466 (patch) | |
| tree | 54defe4afa54dee8c24851318ed9158ee61443cb | |
| parent | d59fe293e2aebd7e348d4bf743975cf685c08eaa (diff) | |
| parent | f02d3d040eb253668f9950455e1ba9c543afe018 (diff) | |
Merge branch 'org.openembedded.dev' of ssh+git://git@git.openembedded.net/openembedded into org.openembedded.dev
| -rw-r--r-- | conf/distro/include/preferred-shr-versions.inc | 6 | ||||
| -rw-r--r-- | conf/distro/include/sane-srcrevs.inc | 2 | ||||
| -rw-r--r-- | recipes/mesa/mesa-dri-7.8/glamo.patch | 2373 | ||||
| -rw-r--r-- | recipes/mesa/mesa-dri_7.8.bb | 2 | ||||
| -rw-r--r-- | recipes/tcpdump/files/configure.patch | 24 | ||||
| -rw-r--r-- | recipes/tcpdump/tcpdump_4.0.0.bb | 1 | ||||
| -rw-r--r-- | recipes/xorg-xserver/xserver-xorg_git.bb | 2 |
7 files changed, 2405 insertions, 5 deletions
diff --git a/conf/distro/include/preferred-shr-versions.inc b/conf/distro/include/preferred-shr-versions.inc index 20c03fef15..7fd951b1d2 100644 --- a/conf/distro/include/preferred-shr-versions.inc +++ b/conf/distro/include/preferred-shr-versions.inc @@ -9,7 +9,7 @@ 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.7.999" +PREFERRED_VERSION_mesa-dri = "7.8" # We need this for jamvm PREFERRED_VERSION_classpath = "0.98" @@ -38,8 +38,8 @@ PREFERRED_VERSION_libtool-sdk = "2.2.6b" PREFERRED_VERSION_udev = "151" PREFERRED_VERSION_usbutils = "0.86" PREFERRED_VERSION_wpa-supplicant = "0.6.9" -PREFERRED_VERSION_glib-2.0 = "2.22.4" -PREFERRED_VERSION_glib-2.0-native = "2.22.4" +PREFERRED_VERSION_glib-2.0 = "2.23.6" +PREFERRED_VERSION_glib-2.0-native = "2.23.6" UDEV_GE_141 = "1" ANGSTROM_QT_VERSION ?= "4.6.2" diff --git a/conf/distro/include/sane-srcrevs.inc b/conf/distro/include/sane-srcrevs.inc index f64bd23b8e..34b3f92882 100644 --- a/conf/distro/include/sane-srcrevs.inc +++ b/conf/distro/include/sane-srcrevs.inc @@ -219,7 +219,7 @@ SRCREV_pn-xserver-kdrive-glamo ?= "9b28d998424c77fbc057dd3a022ccbb122793a52" # Enlightenment Foundation Libraries # Caution: This is not alphabetically, but (roughly) dependency-sorted. # Please leave it like that. -EFL_SRCREV ?= "47589" +EFL_SRCREV ?= "47617" SRCREV_pn-edb-native ?= "${EFL_SRCREV}" SRCREV_pn-edb ?= "${EFL_SRCREV}" SRCREV_pn-eina-native ?= "${EFL_SRCREV}" diff --git a/recipes/mesa/mesa-dri-7.8/glamo.patch b/recipes/mesa/mesa-dri-7.8/glamo.patch new file mode 100644 index 0000000000..cc55c8b91e --- /dev/null +++ b/recipes/mesa/mesa-dri-7.8/glamo.patch @@ -0,0 +1,2373 @@ +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; ++ ++ __DRIdrawable *dPriv; ++}; ++ ++ ++struct glamo_framebuffer ++{ ++ struct gl_framebuffer base; ++ struct glamo_renderbuffer *color_rb[2]; ++}; ++ ++ ++/* This is just a small wrapper function to return NULL if the gl_renderbuffer ++ * is not a glamo_renderbuffer */ ++static inline struct glamo_renderbuffer ++ *glamo_renderbuffer(struct gl_renderbuffer *rb) ++{ ++ struct glamo_renderbuffer *grb = (struct glamo_renderbuffer *)rb; ++ if ( grb && grb->base.ClassID == GLAMO_RB_CLASS ) ++ return grb; ++ else ++ return NULL; ++} ++ ++ ++extern struct glamo_renderbuffer *glamo_create_renderbuffer(GLenum format, ++ __DRIdrawable *driDrawPriv); ++ ++extern void glamo_renderbuffer_set_bo(struct glamo_renderbuffer *grb, ++ struct glamo_bo *bo); ++ ++#endif /* __GLAMO_FBO_H */ ++ ++/* kate: space-indent on; indent-width 3; mixedindent off; indent-mode cstyle; */ +diff --git a/src/mesa/drivers/dri/glamo/glamo_regs.h b/src/mesa/drivers/dri/glamo/glamo_regs.h +new file mode 100644 +index 0000000..02b2294 +--- /dev/null ++++ b/src/mesa/drivers/dri/glamo/glamo_regs.h +@@ -0,0 +1,174 @@ ++#ifndef _GLAMO_REGS_H ++#define _GLAMO_REGS_H ++ ++/* Smedia Glamo 336x/337x driver ++ * ++ * (C) 2007 by OpenMoko, Inc. ++ * Author: Harald Welte <laforge@openmoko.org> ++ * All rights reserved. ++ * ++ * Modified for Glamo Mesa driver by 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 ++ */ ++ ++enum glamo_regster_offsets { ++ GLAMO_REGOFS_GENERIC = 0x0000, ++ GLAMO_REGOFS_HOSTBUS = 0x0200, ++ GLAMO_REGOFS_MEMORY = 0x0300, ++ GLAMO_REGOFS_VIDCAP = 0x0400, ++ GLAMO_REGOFS_ISP = 0x0500, ++ GLAMO_REGOFS_JPEG = 0x0800, ++ GLAMO_REGOFS_MPEG = 0x0c00, ++ GLAMO_REGOFS_LCD = 0x1100, ++ GLAMO_REGOFS_MMC = 0x1400, ++ GLAMO_REGOFS_MPROC0 = 0x1500, ++ GLAMO_REGOFS_MPROC1 = 0x1580, ++ GLAMO_REGOFS_CMDQUEUE = 0x1600, ++ GLAMO_REGOFS_RISC = 0x1680, ++ GLAMO_REGOFS_2D = 0x1700, ++ GLAMO_REGOFS_3D = 0x1b00, ++}; ++ ++ ++#define REG_MPEG(x) (GLAMO_REGOFS_MPEG+(x)) ++ ++enum glamo_register_mpeg { ++ // ++ GLAMO_REG_MPEG_DC_ADDRL = REG_MPEG(0x3c), ++ GLAMO_REG_MPEG_DC_ADDRH = REG_MPEG(0x3e), ++ GLAMO_REG_MPEG_AC_ADDRL = REG_MPEG(0x40), ++ GLAMO_REG_MPEG_AC_ADDRH = REG_MPEG(0x42), ++ // ++ GLAMO_REG_MPEG_SAFE_1 = REG_MPEG(0x60), ++ GLAMO_REG_MPEG_SAFE_2 = REG_MPEG(0x62), ++ GLAMO_REG_MPEG_SAFE_3 = REG_MPEG(0x64), ++ // ++ GLAMO_REG_MPEG_DEC_OUT0_Y_ADDRL = REG_MPEG(0x6e), ++ GLAMO_REG_MPEG_DEC_OUT0_Y_ADDRH = REG_MPEG(0x70), ++ GLAMO_REG_MPEG_DEC_OUT0_U_ADDRL = REG_MPEG(0x72), ++ GLAMO_REG_MPEG_DEC_OUT0_U_ADDRH = REG_MPEG(0x74), ++ GLAMO_REG_MPEG_DEC_OUT0_V_ADDRL = REG_MPEG(0x76), ++ GLAMO_REG_MPEG_DEC_OUT0_V_ADDRH = REG_MPEG(0x78), |
