diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i915/intel_context.c | 26 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.c | 34 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_fbo.h | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.c | 51 |
4 files changed, 39 insertions, 84 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index 2cb57f3a92..ce77b57a3e 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -634,23 +634,23 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, struct intel_renderbuffer *irbStencil = intel_get_renderbuffer(&intel_fb->Base, BUFFER_STENCIL); - if (intel_fb->color_rb[0] && !intel_fb->color_rb[0]->region) { - intel_region_reference(&intel_fb->color_rb[0]->region, - intel->front_region); + if (intel_fb->color_rb[0]) { + intel_renderbuffer_set_region(intel_fb->color_rb[0], + intel->front_region); } - if (intel_fb->color_rb[1] && !intel_fb->color_rb[1]->region) { - intel_region_reference(&intel_fb->color_rb[1]->region, - intel->back_region); + if (intel_fb->color_rb[1]) { + intel_renderbuffer_set_region(intel_fb->color_rb[1], + intel->back_region); } - if (intel_fb->color_rb[2] && !intel_fb->color_rb[2]->region) { - intel_region_reference(&intel_fb->color_rb[2]->region, - intel->third_region); + if (intel_fb->color_rb[2]) { + intel_renderbuffer_set_region(intel_fb->color_rb[2], + intel->third_region); } - if (irbDepth && !irbDepth->region) { - intel_region_reference(&irbDepth->region, intel->depth_region); + if (irbDepth) { + intel_renderbuffer_set_region(irbDepth, intel->depth_region); } - if (irbStencil && !irbStencil->region) { - intel_region_reference(&irbStencil->region, intel->depth_region); + if (irbStencil) { + intel_renderbuffer_set_region(irbStencil, intel->depth_region); } } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 84ac7889b2..c430e90382 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -355,16 +355,27 @@ intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, } +void +intel_renderbuffer_set_region(struct intel_renderbuffer *rb, + struct intel_region *region) +{ + struct intel_region *old; + + old = rb->region; + rb->region = NULL; + intel_region_reference(&rb->region, region); + intel_region_release(&old); + + rb->pfMap = region->map; + rb->pfPitch = region->pitch; +} /** * Create a new intel_renderbuffer which corresponds to an on-screen window, * not a user-created renderbuffer. - * \param width the screen width - * \param height the screen height */ struct intel_renderbuffer * -intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height, - int offset, int pitch, int cpp, void *map) +intel_create_renderbuffer(GLenum intFormat) { GET_CURRENT_CONTEXT(ctx); @@ -388,7 +399,6 @@ intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height, irb->Base.GreenBits = 6; irb->Base.BlueBits = 5; irb->Base.DataType = GL_UNSIGNED_BYTE; - cpp = 2; break; case GL_RGBA8: irb->Base._ActualFormat = GL_RGBA8; @@ -398,28 +408,24 @@ intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height, irb->Base.BlueBits = 8; irb->Base.AlphaBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; - cpp = 4; break; case GL_STENCIL_INDEX8_EXT: irb->Base._ActualFormat = GL_STENCIL_INDEX8_EXT; irb->Base._BaseFormat = GL_STENCIL_INDEX; irb->Base.StencilBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; - cpp = 1; break; case GL_DEPTH_COMPONENT16: irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DepthBits = 16; irb->Base.DataType = GL_UNSIGNED_SHORT; - cpp = 2; break; case GL_DEPTH_COMPONENT24: irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DepthBits = 24; irb->Base.DataType = GL_UNSIGNED_INT; - cpp = 4; break; case GL_DEPTH24_STENCIL8_EXT: irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; @@ -427,7 +433,6 @@ intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height, irb->Base.DepthBits = 24; irb->Base.StencilBits = 8; irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; - cpp = 4; break; default: _mesa_problem(NULL, @@ -444,15 +449,6 @@ intel_create_renderbuffer(GLenum intFormat, GLsizei width, GLsizei height, /* This sets the Get/PutRow/Value functions */ intel_set_span_functions(&irb->Base); - irb->pfMap = map; - irb->pfPitch = pitch / cpp; /* in pixels */ - -#if 00 - irb->region = intel_region_create_static(intel, - DRM_MM_TT, - offset, map, cpp, width, height); -#endif - return irb; } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index dc017f7121..2fda7dca00 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -85,14 +85,12 @@ struct intel_renderbuffer extern struct intel_renderbuffer *intel_renderbuffer(struct gl_renderbuffer *rb); -extern struct intel_renderbuffer *intel_create_renderbuffer(GLenum intFormat, - GLsizei width, - GLsizei height, - int offset, - int pitch, - int cpp, - void *map); +extern void +intel_renderbuffer_set_region(struct intel_renderbuffer *irb, + struct intel_region *region); +extern struct intel_renderbuffer * +intel_create_renderbuffer(GLenum intFormat); extern void intel_fbo_init(struct intel_context *intel); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index abeb0f9b9f..7708eb8564 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -429,41 +429,20 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, /* setup the hardware-based renderbuffers */ { - intel_fb->color_rb[0] - = intel_create_renderbuffer(rgbFormat, - screen->width, screen->height, - screen->front.offset, - screen->front.pitch, - screen->cpp, - screen->front.map); - intel_set_span_functions(&intel_fb->color_rb[0]->Base); + intel_fb->color_rb[0] = intel_create_renderbuffer(rgbFormat); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT, &intel_fb->color_rb[0]->Base); } if (mesaVis->doubleBufferMode) { - intel_fb->color_rb[1] - = intel_create_renderbuffer(rgbFormat, - screen->width, screen->height, - screen->back.offset, - screen->back.pitch, - screen->cpp, - screen->back.map); - intel_set_span_functions(&intel_fb->color_rb[1]->Base); + intel_fb->color_rb[1] = intel_create_renderbuffer(rgbFormat); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT, &intel_fb->color_rb[1]->Base); if (screen->third.handle) { struct gl_renderbuffer *tmp_rb = NULL; - intel_fb->color_rb[2] - = intel_create_renderbuffer(rgbFormat, - screen->width, screen->height, - screen->third.offset, - screen->third.pitch, - screen->cpp, - screen->third.map); - intel_set_span_functions(&intel_fb->color_rb[2]->Base); + intel_fb->color_rb[2] = intel_create_renderbuffer(rgbFormat); _mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base); } } @@ -472,13 +451,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, if (mesaVis->stencilBits == 8) { /* combined depth/stencil buffer */ struct intel_renderbuffer *depthStencilRb - = intel_create_renderbuffer(GL_DEPTH24_STENCIL8_EXT, - screen->width, screen->height, - screen->depth.offset, - screen->depth.pitch, - screen->cpp, /* 4! */ - screen->depth.map); - intel_set_span_functions(&depthStencilRb->Base); + = intel_create_renderbuffer(GL_DEPTH24_STENCIL8_EXT); /* note: bind RB to two attachment points */ _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthStencilRb->Base); @@ -486,13 +459,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, &depthStencilRb->Base); } else { struct intel_renderbuffer *depthRb - = intel_create_renderbuffer(GL_DEPTH_COMPONENT24, - screen->width, screen->height, - screen->depth.offset, - screen->depth.pitch, - screen->cpp, /* 4! */ - screen->depth.map); - intel_set_span_functions(&depthRb->Base); + = intel_create_renderbuffer(GL_DEPTH_COMPONENT24); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base); } @@ -500,13 +467,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, else if (mesaVis->depthBits == 16) { /* just 16-bit depth buffer, no hw stencil */ struct intel_renderbuffer *depthRb - = intel_create_renderbuffer(GL_DEPTH_COMPONENT16, - screen->width, screen->height, - screen->depth.offset, - screen->depth.pitch, - screen->cpp, /* 2! */ - screen->depth.map); - intel_set_span_functions(&depthRb->Base); + = intel_create_renderbuffer(GL_DEPTH_COMPONENT16); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base); } |