diff options
author | Eric Anholt <eric@anholt.net> | 2011-10-11 14:46:31 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2011-11-01 15:42:17 -0700 |
commit | bae10c0d2e518f06c3686e04c778f0da73525b4d (patch) | |
tree | e5680dc5c8f66a71c1b411ceda6f970ad734d789 | |
parent | 92054cd94e2188c9f4d56ddf9377c5aeb8a4e64e (diff) |
intel: Use MapRenderbuffer in spans setup.
Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_span.c | 33 |
1 files changed, 10 insertions, 23 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 2819acb443b..604962d3f54 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -221,7 +221,10 @@ intel_offset_S8(uint32_t stride, uint32_t x, uint32_t y) void intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb) { + struct gl_context *ctx = &intel->ctx; struct intel_renderbuffer *irb = intel_renderbuffer(rb); + GLubyte *map; + int stride; if (!irb) return; @@ -231,25 +234,11 @@ intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb) if (irb->wrapped_stencil) intel_renderbuffer_map(intel, irb->wrapped_stencil); - if (!irb->region) - return; - - drm_intel_gem_bo_map_gtt(irb->region->bo); - - rb->Data = irb->region->bo->virtual; - rb->RowStride = irb->region->pitch; - - if (!rb->Name) { - /* Flip orientation of the window system buffer */ - rb->Data += rb->RowStride * (irb->region->height - 1) * irb->region->cpp; - rb->RowStride = -rb->RowStride; - } else { - /* Adjust the base pointer of a texture image drawbuffer to the image - * within the miptree region (all else has draw_x/y = 0). - */ - rb->Data += irb->draw_x * irb->region->cpp; - rb->Data += irb->draw_y * rb->RowStride * irb->region->cpp; - } + ctx->Driver.MapRenderbuffer(ctx, rb, 0, 0, rb->Width, rb->Height, + GL_MAP_READ_BIT | GL_MAP_WRITE_BIT, + &map, &stride); + rb->Data = map; + rb->RowStride = stride / _mesa_get_format_bytes(rb->Format); intel_set_span_functions(intel, rb); } @@ -258,6 +247,7 @@ void intel_renderbuffer_unmap(struct intel_context *intel, struct gl_renderbuffer *rb) { + struct gl_context *ctx = &intel->ctx; struct intel_renderbuffer *irb = intel_renderbuffer(rb); if (!irb) @@ -268,10 +258,7 @@ intel_renderbuffer_unmap(struct intel_context *intel, if (irb->wrapped_stencil) intel_renderbuffer_unmap(intel, irb->wrapped_stencil); - if (!irb->region) - return; - - drm_intel_gem_bo_unmap_gtt(irb->region->bo); + ctx->Driver.UnmapRenderbuffer(ctx, rb); rb->GetRow = NULL; rb->PutRow = NULL; |