From 9610c8092ec877319512e794b328aec514364c95 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 14 Apr 2009 00:13:55 +0100 Subject: Framebuffer, renderbuffer, state and initial triangle stuff --- src/mesa/drivers/dri/glamo/glamo_context.c | 105 ++++++++++++++++++------- src/mesa/drivers/dri/glamo/glamo_fbo.c | 120 +++++++++++++++++++++++++++++ src/mesa/drivers/dri/glamo/glamo_fbo.h | 75 ++++++++++++++++++ src/mesa/drivers/dri/glamo/glamo_screen.c | 69 +++++++++++++---- src/mesa/drivers/dri/glamo/glamo_screen.h | 4 + src/mesa/drivers/dri/glamo/glamo_state.c | 76 ++++++++++++------ src/mesa/drivers/dri/glamo/glamo_tris.c | 76 ++++++++++++++++++ src/mesa/drivers/dri/glamo/glamo_tris.h | 33 ++++++++ 8 files changed, 493 insertions(+), 65 deletions(-) create mode 100644 src/mesa/drivers/dri/glamo/glamo_fbo.c create mode 100644 src/mesa/drivers/dri/glamo/glamo_fbo.h create mode 100644 src/mesa/drivers/dri/glamo/glamo_tris.c create mode 100644 src/mesa/drivers/dri/glamo/glamo_tris.h diff --git a/src/mesa/drivers/dri/glamo/glamo_context.c b/src/mesa/drivers/dri/glamo/glamo_context.c index 42251470c0..f3c1dd32b8 100644 --- a/src/mesa/drivers/dri/glamo/glamo_context.c +++ b/src/mesa/drivers/dri/glamo/glamo_context.c @@ -3,6 +3,7 @@ * * (c) 2009 Thomas White * 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"), @@ -31,10 +32,13 @@ #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" #define DRIVER_DATE "20090402" @@ -57,20 +61,21 @@ static const GLubyte *glamoGetString(GLcontext *ctx, GLenum name) } +/* 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 glamesa = GLAMO_CONTEXT(ctx); + glamoContextPtr glamo = GLAMO_CONTEXT(ctx); - *width = glamesa->driDrawable->w; - *height = glamesa->driDrawable->h; + *width = glamo->driDrawable->w; + *height = glamo->driDrawable->h; } GLboolean glamoCreateContext(const __GLcontextModes *glVisual, - __DRIcontext *driContextPriv, - void *sharedContextPrivate) + __DRIcontext *driContextPriv, + void *sharedContextPrivate) { GLcontext *ctx, *shareCtx; __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; @@ -107,22 +112,25 @@ GLboolean glamoCreateContext(const __GLcontextModes *glVisual, context->driDrawable = NULL; context->driFd = sPriv->fd; - /* Parse configuration files */ -// driParseConfigFiles(&context->optionCache, &glamoScreen->optionCache, -// glamoScreen->driScreen->myNum, "glamo"); - /* Initialize the software rasterizer and helper modules. */ _swrast_CreateContext(ctx); _vbo_CreateContext(ctx); _tnl_CreateContext(ctx); _swsetup_CreateContext(ctx); + /* use default TCL pipeline */ + { + TNLcontext *tnl = TNL_CONTEXT(ctx); + tnl->Driver.RunPipeline = _tnl_run_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); glamoInitStateFuncs(ctx); + glamoInitTriFuncs(ctx); return GL_TRUE; } @@ -150,34 +158,79 @@ void glamoDestroyContext(__DRIcontext *driContextPriv) } +static void glamo_update_renderbuffers(__DRIcontext *context, + __DRIdrawable *drawable) +{ + unsigned int attachments[10]; + __DRIbuffer *buffers; + __DRIscreen *screen; + struct glamo_renderbuffer *grb; + int i, count; + struct glamo_framebuffer *draw; + glamoContextPtr glamo; + char *regname; + + fprintf(stderr, "enter %s, drawable %p\n", __func__, drawable); + + 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; +printf("screen = %p\n", screen); fflush(stdout); +printf("screen->dri2.loader = %p\n", screen->dri2.loader); fflush(stdout); +printf("screen->dri2.loader->getBuffers = %p\n", screen->dri2.loader->getBuffers); fflush(stdout); + buffers = (*screen->dri2.loader->getBuffers)(drawable, + &drawable->w, + &drawable->h, + attachments, i, + &count, + drawable->loaderPrivate); +printf("b\n"); fflush(stdout); + if (buffers == NULL) return; +printf("c\n"); fflush(stdout); + + printf("%i, %i\n", drawable->w, drawable->h); +} + + GLboolean glamoMakeCurrent(__DRIcontext *driContextPriv, __DRIdrawable *driDrawPriv, __DRIdrawable *driReadPriv) { - if ( driContextPriv ) { + struct glamo_framebuffer *draw_fb; + struct gl_framebuffer *read_fb; + glamoContextPtr glamo; - GET_CURRENT_CONTEXT(ctx); - glamoContextPtr oldGlamoCtx; - glamoContextPtr newGlamoCtx; - struct gl_framebuffer *drawBuffer, *readBuffer; + printf("glamoMakeCurrent\n"); fflush(stdout); - oldGlamoCtx = ctx ? GLAMO_CONTEXT(ctx) : NULL; - newGlamoCtx = (glamoContextPtr)driContextPriv->driverPrivate; + if ( driContextPriv == NULL ) { + _mesa_make_current(NULL, NULL, NULL); + return GL_TRUE; + } - if ( newGlamoCtx != oldGlamoCtx) { - newGlamoCtx->GlobalFlag = GFLAG_ALL; - } + /* The Glamo context we're switching to */ + glamo = (glamoContextPtr)driContextPriv->driverPrivate; - newGlamoCtx->driDrawable = driDrawPriv; + glamo->driDrawable = driDrawPriv; - drawBuffer = (GLframebuffer *)driDrawPriv->driverPrivate; - readBuffer = (GLframebuffer *)driReadPriv->driverPrivate; + /* These two will probably be the same */ + draw_fb = (struct glamo_framebuffer *)driDrawPriv->driverPrivate; + read_fb = (struct gl_framebuffer *)driReadPriv->driverPrivate; - _mesa_make_current(newGlamoCtx->glCtx, drawBuffer, readBuffer); + glamo_update_renderbuffers(driContextPriv, driDrawPriv); + if (driDrawPriv != driReadPriv) + glamo_update_renderbuffers(driContextPriv, driReadPriv); - } else { - _mesa_make_current(NULL, NULL, NULL); - } +printf("%p %p %p %p\n", glamo->glCtx, draw_fb, &draw_fb->base, read_fb); +fflush(stdout); + _mesa_make_current(glamo->glCtx, &draw_fb->base, read_fb); +printf("BBB\n"); fflush(stdout); + _mesa_update_state(glamo->glCtx); +printf("done\n"); fflush(stdout); return GL_TRUE; } 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 0000000000..13de654577 --- /dev/null +++ b/src/mesa/drivers/dri/glamo/glamo_fbo.c @@ -0,0 +1,120 @@ +/* + * Direct Rendering Support for SMedia Glamo 336x/337x + * + * (c) 2009 Thomas White + * 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/fbobject.h" +#include "main/framebuffer.h" +#include "main/renderbuffer.h" +#include "main/context.h" +#include "dri_util.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->_ActualFormat = internalFormat; + printf("alloc_window_storage\n");fflush(stdout); + return GL_TRUE; +} + + +/* Create a buffer, such as a colour or depth buffer */ +struct glamo_renderbuffer *glamo_create_renderbuffer(GLenum format, + __DRIdrawablePrivate *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._ActualFormat = GL_RGB5; + grb->base._BaseFormat = GL_RGBA; + grb->base.RedBits = 5; + grb->base.GreenBits = 6; + grb->base.BlueBits = 5; + grb->base.DataType = GL_UNSIGNED_BYTE; + break; + case GL_DEPTH_COMPONENT16: + grb->base._ActualFormat = GL_DEPTH_COMPONENT16; + grb->base._BaseFormat = GL_DEPTH_COMPONENT; + grb->base.DepthBits = 16; + grb->base.DataType = GL_UNSIGNED_SHORT; + 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; +} + + +/* 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 0000000000..2da6633331 --- /dev/null +++ b/src/mesa/drivers/dri/glamo/glamo_fbo.h @@ -0,0 +1,75 @@ +/* + * Direct Rendering Support for SMedia Glamo 336x/337x + * + * (c) 2009 Thomas White + * + * 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; + + __DRIdrawablePrivate *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, + __DRIdrawablePrivate *driDrawPriv); + + +#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_screen.c b/src/mesa/drivers/dri/glamo/glamo_screen.c index 1701eac2c0..82f2f6233d 100644 --- a/src/mesa/drivers/dri/glamo/glamo_screen.c +++ b/src/mesa/drivers/dri/glamo/glamo_screen.c @@ -32,6 +32,10 @@ #include "glamo_screen.h" #include "glamo_context.h" +#include "glamo_fbo.h" + +/* This comes from libdrm_glamo */ +#include static int glamoInitDriver(__DRIscreenPrivate *psp) @@ -51,9 +55,8 @@ static glamoScreenPtr glamoCreateScreen(__DRIscreenPrivate *sPriv) glamoScreen->driScreen = sPriv; - /* parse information in __driConfigOptions */ -// driParseOptionInfo(&glamoScreen->optionCache, -// __driConfigOptions, __driNConfigOptions); + /* This is our link to the kernel's memory manager, via libdrm */ + glamoScreen->bom = glamo_bo_manager_gem_ctor(sPriv->fd); return glamoScreen; } @@ -144,26 +147,57 @@ static const __DRIconfig **glamoInitScreen2(__DRIscreenPrivate *sPriv) return (const __DRIconfig **)configs; } + +/* Allocate buffers for a context. This is where the fun starts... */ static GLboolean glamoCreateBuffer(__DRIscreen *driScrnPriv, __DRIdrawable *driDrawPriv, - const __GLcontextModes *glVis, - GLboolean pixmapBuffer) + const __GLcontextModes *mesaVis, + GLboolean isPixmap) { - struct gl_framebuffer *fb; + glamoScreenPtr screen = (glamoScreenPtr)driScrnPriv->private; + struct glamo_framebuffer *gfb; + GLenum rgbFormat; + + printf("glamoCreateBuffer\n");fflush(stdout); + + if ( isPixmap ) return GL_FALSE; /* not implemented */ + + gfb = CALLOC_STRUCT(glamo_framebuffer); + if ( !gfb ) return GL_FALSE; - if ( pixmapBuffer ) - return GL_FALSE; /* not implemented */ + _mesa_initialize_framebuffer(&gfb->base, mesaVis); - fb = _mesa_create_framebuffer(glVis); + /* we only support this one format at the moment */ + rgbFormat = GL_RGB5; + + /* Front color renderbuffer */ + gfb->color_rb[0] = glamo_create_renderbuffer(rgbFormat, driDrawPriv); + _mesa_add_renderbuffer(&gfb->base, BUFFER_FRONT_LEFT, + &gfb->color_rb[0]->base); + + /* Back color renderbuffer, if requested */ + if ( mesaVis->doubleBufferMode ) { + gfb->color_rb[1] = glamo_create_renderbuffer(rgbFormat, driDrawPriv); + _mesa_add_renderbuffer(&gfb->base, BUFFER_BACK_LEFT, + &gfb->color_rb[1]->base); + } + + if ( mesaVis->depthBits == 16 ) { + struct glamo_renderbuffer *depth; + depth = glamo_create_renderbuffer(GL_DEPTH_COMPONENT16, driDrawPriv); + _mesa_add_renderbuffer(&gfb->base, BUFFER_DEPTH, &depth->base); + } - _mesa_add_soft_renderbuffers(fb, - GL_FALSE, /* color */ - GL_FALSE, /* depth */ - glVis->stencilBits > 0, - glVis->accumRedBits > 0, - GL_FALSE, /* alpha */ - GL_FALSE /* aux */); - driDrawPriv->driverPrivate = (void *)fb; + /* Add software renderbuffers for the things we can't support in hardware */ + _mesa_add_soft_renderbuffers(&gfb->base, + GL_FALSE, /* color */ + GL_FALSE, /* depth */ + mesaVis->stencilBits > 0, /* stencil, if required */ + mesaVis->accumRedBits > 0, /* accum, if required */ + GL_FALSE, /* alpha */ + GL_FALSE /* aux */ + ); + driDrawPriv->driverPrivate = (void *)gfb; return (driDrawPriv->driverPrivate != NULL); } @@ -176,6 +210,7 @@ static void glamoDestroyBuffer(__DRIdrawable *driDrawPriv) static void glamoSwapBuffers(__DRIdrawable *driDrawPriv) { + printf("glamoSwapBuffers\n"); fflush(stdout); } diff --git a/src/mesa/drivers/dri/glamo/glamo_screen.h b/src/mesa/drivers/dri/glamo/glamo_screen.h index 79ff949ad7..8cd98c9056 100644 --- a/src/mesa/drivers/dri/glamo/glamo_screen.h +++ b/src/mesa/drivers/dri/glamo/glamo_screen.h @@ -28,11 +28,15 @@ #include "xmlconfig.h" #include "dri_util.h" +#include + typedef struct { __DRIscreenPrivate *driScreen; driOptionCache optionCache; + struct glamo_bo_manager *bom; + } glamoScreenRec, *glamoScreenPtr; #endif /* __GLAMO_SCREEN_H */ diff --git a/src/mesa/drivers/dri/glamo/glamo_state.c b/src/mesa/drivers/dri/glamo/glamo_state.c index eaf65ac8f2..47149e5b4f 100644 --- a/src/mesa/drivers/dri/glamo/glamo_state.c +++ b/src/mesa/drivers/dri/glamo/glamo_state.c @@ -28,40 +28,72 @@ void glamoClear(GLcontext *ctx, GLbitfield mask) { - printf("glamoClear\n"); + printf("glamoClear\n"); fflush(stdout); +} + + +void glamoClearColor(GLcontext *ctx, const GLfloat color[4]) +{ + printf("glamoClearColor\n"); fflush(stdout); +} + + +static void glamoShadeModel(GLcontext *ctx, GLenum mode) +{ + printf("glamoShadeModel\n"); fflush(stdout); +} + + +static void glamoViewport(GLcontext *ctx, GLint x, GLint y, + GLsizei width, GLsizei height ) +{ + printf("glamoViewport\n"); fflush(stdout); +} + + +static void glamoUpdateState(GLcontext *ctx, GLbitfield new_state) +{ + printf("glamoUpdateState\n"); +} + + +static void glamoFlush(GLcontext *ctx) +{ + printf("glamoFlush\n"); } void glamoInitStateFuncs(GLcontext *ctx) { - ctx->Driver.UpdateState = NULL;//sisDDInvalidateState; + ctx->Driver.UpdateState = glamoUpdateState; ctx->Driver.Clear = glamoClear; - ctx->Driver.ClearColor = NULL;//sisDDClearColor; - ctx->Driver.ClearDepth = NULL;//sisDDClearDepth; - ctx->Driver.ClearStencil = NULL;//sisDDClearStencil; - ctx->Driver.AlphaFunc = NULL;//sisDDAlphaFunc; - ctx->Driver.BlendFuncSeparate = NULL;//sisDDBlendFuncSeparate; - ctx->Driver.ColorMask = NULL;//sisDDColorMask; - ctx->Driver.CullFace = NULL;//sisDDCullFace; - ctx->Driver.DepthMask = NULL;//sisDDDepthMask; - ctx->Driver.DepthFunc = NULL;//sisDDDepthFunc; - ctx->Driver.DepthRange = NULL;//sisDDDepthRange; - ctx->Driver.DrawBuffer = NULL;//sisDDDrawBuffer; - ctx->Driver.Enable = NULL;//sisDDEnable; - ctx->Driver.FrontFace = NULL;//sisDDFrontFace; - ctx->Driver.Fogfv = NULL;//sisDDFogfv; + ctx->Driver.ClearColor = glamoClearColor; + ctx->Driver.ClearDepth = NULL; + ctx->Driver.ClearStencil = NULL; + ctx->Driver.AlphaFunc = NULL; + ctx->Driver.BlendFuncSeparate = NULL; + ctx->Driver.ColorMask = NULL; + ctx->Driver.CullFace = NULL; + ctx->Driver.DepthMask = NULL; + ctx->Driver.DepthFunc = NULL; + ctx->Driver.DepthRange = NULL; + ctx->Driver.DrawBuffer = NULL; + ctx->Driver.Enable = NULL; + ctx->Driver.FrontFace = NULL; + ctx->Driver.Fogfv = NULL; ctx->Driver.Hint = NULL; ctx->Driver.Lightfv = NULL; - ctx->Driver.LogicOpcode = NULL;//sisDDLogicOpCode; + ctx->Driver.LogicOpcode = NULL; ctx->Driver.PolygonMode = NULL; ctx->Driver.PolygonStipple = NULL; ctx->Driver.ReadBuffer = NULL; ctx->Driver.RenderMode = NULL; - ctx->Driver.Scissor = NULL;//sisDDScissor; - ctx->Driver.ShadeModel = NULL;//sisDDShadeModel; - ctx->Driver.LightModelfv = NULL;//sisDDLightModelfv; - ctx->Driver.Viewport = NULL;//sisDDViewport; - ctx->Driver.ResizeBuffers = NULL;//sisReAllocateBuffers; + ctx->Driver.Scissor = NULL; + ctx->Driver.ShadeModel = glamoShadeModel; + ctx->Driver.LightModelfv = NULL; + ctx->Driver.Viewport = glamoViewport; + ctx->Driver.ResizeBuffers = NULL; + ctx->Driver.Flush = glamoFlush; } /* kate: space-indent on; indent-width 3; mixedindent off; indent-mode cstyle; */ diff --git a/src/mesa/drivers/dri/glamo/glamo_tris.c b/src/mesa/drivers/dri/glamo/glamo_tris.c new file mode 100644 index 0000000000..07a19286cf --- /dev/null +++ b/src/mesa/drivers/dri/glamo/glamo_tris.c @@ -0,0 +1,76 @@ +/* + * Direct Rendering Support for SMedia Glamo 336x/337x + * + * (c) 2009 Thomas White + * + * 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/mtypes.h" +#include "swrast/swrast.h" +#include "tnl/t_context.h" +#include "tnl/t_vertex.h" + +#include "glamo_tris.h" + + +static void glamoRunPipeline(GLcontext *ctx) +{ + printf("glamoRunPipeline\n"); +} + + +static void glamoRenderStart(GLcontext *ctx) +{ + printf("glamoRenderStart\n"); +} + + +static void glamoRenderFinish(GLcontext *ctx) +{ + printf("glamoRenderFinish\n"); +} + + +static void glamoRenderPrimitive(GLcontext *ctx, GLenum prim) +{ + printf("glamoRenderPrimitive\n"); +} + + +void glamoInitTriFuncs(GLcontext *ctx) +{ + TNLcontext *tnl = TNL_CONTEXT(ctx); + static int firsttime = 1; + + if (firsttime) { +// init_rast_tab(); + firsttime = 0; + } + + tnl->Driver.RunPipeline = glamoRunPipeline; + tnl->Driver.Render.Start = glamoRenderStart; + tnl->Driver.Render.Finish = glamoRenderFinish; + tnl->Driver.Render.PrimitiveNotify = glamoRenderPrimitive; + tnl->Driver.Render.ResetLineStipple = _swrast_ResetLineStipple; + tnl->Driver.Render.BuildVertices = _tnl_build_vertices; +} + + +/* kate: space-indent on; indent-width 3; mixedindent off; indent-mode cstyle; */ diff --git a/src/mesa/drivers/dri/glamo/glamo_tris.h b/src/mesa/drivers/dri/glamo/glamo_tris.h new file mode 100644 index 0000000000..a0f0c2d342 --- /dev/null +++ b/src/mesa/drivers/dri/glamo/glamo_tris.h @@ -0,0 +1,33 @@ +/* + * Direct Rendering Support for SMedia Glamo 336x/337x + * + * (c) 2009 Thomas White + * + * 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_TRIS_H +#define __GLAMO_TRIS_H + +#include "main/mtypes.h" + +extern void glamoInitTriFuncs(GLcontext *ctx); + +#endif /* __GLAMO_TRIS_H */ + +/* kate: space-indent on; indent-width 3; mixedindent off; indent-mode cstyle; */ -- cgit v1.2.3