summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-09-13 20:38:52 +0100
committerMartin Jansa <Martin.Jansa@gmail.com>2010-02-18 15:39:22 +0100
commit499aa86d7c75943fe18b6e42994dc8ef67c6140e (patch)
tree63f7f97001821e6d4e0744130cb5cf9b7210eac8
parenteb02458db910e00cbd107d8f0a591e311f34009c (diff)
Indentation
It's official. Indenting with spaces make me sick.
-rw-r--r--src/mesa/drivers/dri/glamo/glamo_context.c468
1 files changed, 233 insertions, 235 deletions
diff --git a/src/mesa/drivers/dri/glamo/glamo_context.c b/src/mesa/drivers/dri/glamo/glamo_context.c
index f44cf1016d..3a6c0ff797 100644
--- a/src/mesa/drivers/dri/glamo/glamo_context.c
+++ b/src/mesa/drivers/dri/glamo/glamo_context.c
@@ -47,34 +47,37 @@
#include <glamo_drm.h>
-#define DRIVER_DATE "20090402"
+#define DRIVER_DATE "20090913"
static inline struct glamo_renderbuffer *glamo_get_renderbuffer(
struct gl_framebuffer *fb,
int att_index)
{
- if ( att_index >= 0 )
- return glamo_renderbuffer(fb->Attachment[att_index].Renderbuffer);
- else
- return NULL;
+ 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;
- }
+ 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;
+ }
}
@@ -82,11 +85,11 @@ static const GLubyte *glamoGetString(GLcontext *ctx, GLenum name)
static void glamoBufferSize(GLframebuffer *buffer,
GLuint *width, GLuint *height)
{
- GET_CURRENT_CONTEXT(ctx);
- glamoContextPtr glamo = GLAMO_CONTEXT(ctx);
+ GET_CURRENT_CONTEXT(ctx);
+ glamoContextPtr glamo = GLAMO_CONTEXT(ctx);
- *width = glamo->driDrawable->w;
- *height = glamo->driDrawable->h;
+ *width = glamo->driDrawable->w;
+ *height = glamo->driDrawable->h;
}
@@ -94,253 +97,248 @@ GLboolean glamoCreateContext(const __GLcontextModes *glVisual,
__DRIcontext *driContextPriv,
void *sharedContextPrivate)
{
- GLcontext *ctx, *shareCtx;
- __DRIscreenPrivate *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->driFd = sPriv->fd;
-
- /* 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;
+ GLcontext *ctx, *shareCtx;
+ __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv;
+ glamoContextPtr context;
+ glamoScreenPtr glamoScreen;
+ struct dd_function_table functions;
+ TNLcontext *tnl;
+
+ 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->driFd = sPriv->fd;
+
+ /* Initialize the software rasterizer and helper modules. */
+ _swrast_CreateContext(ctx);
+ _vbo_CreateContext(ctx);
+ _tnl_CreateContext(ctx);
+ _swsetup_CreateContext(ctx);
+
+ /* use default TCL pipeline */
+ 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;
}
void glamoDestroyContext(__DRIcontext *driContextPriv)
{
- glamoContextPtr context;
+ glamoContextPtr context;
- context = (glamoContextPtr)driContextPriv->driverPrivate;
- assert(context != NULL);
+ context = (glamoContextPtr)driContextPriv->driverPrivate;
+ assert(context != NULL);
- if ( context != NULL ) {
+ if ( context != NULL ) {
- _swsetup_DestroyContext(context->glCtx);
- _tnl_DestroyContext(context->glCtx);
- _vbo_DestroyContext(context->glCtx);
- _swrast_DestroyContext(context->glCtx);
+ _swsetup_DestroyContext(context->glCtx);
+ _tnl_DestroyContext(context->glCtx);
+ _vbo_DestroyContext(context->glCtx);
+ _swrast_DestroyContext(context->glCtx);
- _mesa_destroy_context(context->glCtx);
+ _mesa_destroy_context(context->glCtx);
- }
+ }
- FREE(context);
+ FREE(context);
}
static 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;
- char *regname;
- struct glamo_bo *bo;
- struct glamo_bo *depth_bo;
-
- 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;
-
- buffers = (*screen->dri2.loader->getBuffers)(drawable,
- &drawable->w,
- &drawable->h,
- attachments, i,
- &count,
- drawable->loaderPrivate);
-
- if (buffers == NULL) return;
-
- printf("%i, %i\n", drawable->w, drawable->h);
-
- /* 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];
- regname = "dri2 front buffer";
- break;
- case __DRI_BUFFER_BACK_LEFT:
- grb = draw->color_rb[1];
- regname = "dri2 back buffer";
- break;
- case __DRI_BUFFER_DEPTH:
- grb = glamo_get_renderbuffer(&draw->base, BUFFER_DEPTH);
- regname = "dri2 depth buffer";
- break;
- case __DRI_BUFFER_STENCIL:
- grb = glamo_get_renderbuffer(&draw->base, BUFFER_STENCIL);
- regname = "dri2 stencil buffer";
- break;
- case __DRI_BUFFER_FAKE_FRONT_LEFT:
- grb = glamo_get_renderbuffer(&draw->base, BUFFER_STENCIL);
- regname = "dri2 fake front buffer";
- break;
- case __DRI_BUFFER_ACCUM:
- default:
- fprintf(stderr,
- "unhandled buffer attach event, attachment type %d\n",
- buffers[i].attachment);
- return;
- }
-
- if ( grb == NULL ) continue;
-
- if ( grb->bo ) {
- uint32_t name = glamo_gem_get_name(grb->bo);
- if ( name == buffers[i].name ) continue;
- }
-
- fprintf(stderr, "attaching buffer %s, %d, at %d, cpp %d, pitch %d\n",
- regname, buffers[i].name, buffers[i].attachment,
- buffers[i].cpp, buffers[i].pitch);
-
- 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 %s %d\n", regname, buffers[i].name);
- }
-
- if ( buffers[i].attachment == __DRI_BUFFER_DEPTH ) {
- if ( draw->base.Visual.depthBits == 16 ) grb->cpp = 2;
- depth_bo = bo;
- }
-
- glamo_renderbuffer_set_bo(grb, bo);
- glamo_bo_unref(bo);
- }
-
- driUpdateFramebufferSize(glamo->glCtx, drawable);
+ unsigned int attachments[10];
+ __DRIbuffer *buffers;
+ __DRIscreen *screen;
+ int i, count;
+ struct glamo_framebuffer *draw;
+ glamoContextPtr glamo;
+ char *regname;
+ struct glamo_bo *bo;
+ struct glamo_bo *depth_bo;
+
+ 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;
+
+ buffers = (*screen->dri2.loader->getBuffers)(drawable,
+ &drawable->w,
+ &drawable->h,
+ attachments, i,
+ &count,
+ drawable->loaderPrivate);
+
+ if (buffers == NULL) return;
+
+ printf("%i, %i\n", drawable->w, drawable->h);
+
+ /* 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];
+ regname = "dri2 front buffer";
+ break;
+ case __DRI_BUFFER_BACK_LEFT:
+ grb = draw->color_rb[1];
+ regname = "dri2 back buffer";
+ break;
+ case __DRI_BUFFER_DEPTH:
+ grb = glamo_get_renderbuffer(&draw->base, BUFFER_DEPTH);
+ regname = "dri2 depth buffer";
+ break;
+ case __DRI_BUFFER_STENCIL:
+ grb = glamo_get_renderbuffer(&draw->base, BUFFER_STENCIL);
+ regname = "dri2 stencil buffer";
+ break;
+ case __DRI_BUFFER_FAKE_FRONT_LEFT:
+ grb = glamo_get_renderbuffer(&draw->base, BUFFER_STENCIL);
+ regname = "dri2 fake front buffer";
+ break;
+ case __DRI_BUFFER_ACCUM:
+ default:
+ fprintf(stderr,
+ "unhandled buffer attach event, attachment type %d\n",
+ buffers[i].attachment);
+ return;
+ }
+ if ( grb == NULL ) continue;
+
+ if ( grb->bo ) {
+ uint32_t name = glamo_gem_get_name(grb->bo);
+ if ( name == buffers[i].name ) continue;
+ }
+
+ fprintf(stderr, "Attaching buffer %s, %d, at %d, cpp %d, pitch %d\n",
+ regname, buffers[i].name, buffers[i].attachment,
+ buffers[i].cpp, buffers[i].pitch);
+
+ 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 %s %d\n",
+ regname, buffers[i].name);
+ }
+
+ if ( buffers[i].attachment == __DRI_BUFFER_DEPTH ) {
+ if ( draw->base.Visual.depthBits == 16 ) grb->cpp = 2;
+ depth_bo = bo;
+ }
+
+ glamo_renderbuffer_set_bo(grb, bo);
+ glamo_bo_unref(bo);
+ }
+
+ driUpdateFramebufferSize(glamo->glCtx, drawable);
}
GLboolean glamoMakeCurrent(__DRIcontext *driContextPriv,
- __DRIdrawable *driDrawPriv,
- __DRIdrawable *driReadPriv)
+ __DRIdrawable *driDrawPriv,
+ __DRIdrawable *driReadPriv)
{
- struct glamo_framebuffer *draw_fb;
- struct gl_framebuffer *read_fb;
- glamoContextPtr glamo;
+ struct glamo_framebuffer *draw_fb;
+ struct gl_framebuffer *read_fb;
+ glamoContextPtr glamo;
- printf("glamoMakeCurrent\n"); fflush(stdout);
+ printf("glamoMakeCurrent\n"); fflush(stdout);
- if ( driContextPriv == NULL ) {
- _mesa_make_current(NULL, NULL, NULL);
- return GL_TRUE;
- }
+ if ( driContextPriv == NULL ) {
+ _mesa_make_current(NULL, NULL, NULL);
+ return GL_TRUE;
+ }
- /* The Glamo context we're switching to */
- glamo = (glamoContextPtr)driContextPriv->driverPrivate;
+ /* The Glamo context we're switching to */
+ glamo = (glamoContextPtr)driContextPriv->driverPrivate;
- glamo->driDrawable = driDrawPriv;
+ glamo->driDrawable = driDrawPriv;
- /* These two will probably be the same */
- draw_fb = (struct glamo_framebuffer *)driDrawPriv->driverPrivate;
- read_fb = (struct gl_framebuffer *)driReadPriv->driverPrivate;
+ /* 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);
+ glamo_update_renderbuffers(driContextPriv, driDrawPriv);
+ if (driDrawPriv != driReadPriv)
+ glamo_update_renderbuffers(driContextPriv, driReadPriv);
-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);
+ 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);
+ _mesa_update_state(glamo->glCtx);
- return GL_TRUE;
+ return GL_TRUE;
}
GLboolean glamoUnbindContext(__DRIcontext *driContextPriv)
{
- return GL_TRUE;
+ return GL_TRUE;
}
-
-/* kate: space-indent on; indent-width 3; mixedindent off; indent-mode cstyle; */