diff options
author | Eric Anholt <eric@anholt.net> | 2009-01-20 10:45:23 -0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-02-24 12:21:00 -0800 |
commit | 8ff94b4cf760ab4c124d55640d2818e94c374ea4 (patch) | |
tree | 0f580c1f7cd6a09b30bf1b5e0073bcbe7041441e | |
parent | ee2f802d7f5beb0b0af242412dda17b4093a3547 (diff) |
Use drm_intel_bo_subdata to put render vb data in.
This improves performance by avoiding repeated map/unmap cycles, which are
a bit expensive on my machine with lock debugging on in the kernel. It could
do much better if we did more than 18 or so floats at a time.
(cherry picked from commit b6f3ce32e295929f461a7bc37e61f126fb51e4aa)
-rw-r--r-- | src/i965_render.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/i965_render.c b/src/i965_render.c index 1d63eb8c..0d7d8f3c 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -1395,12 +1395,6 @@ i965_get_vb_space(ScrnInfoPtr pScrn) render_state->vb_offset = 0; } - /* Map the vertex_buffer buffer object so we can write to it. */ - if (drm_intel_bo_map(render_state->vertex_buffer_bo, 1) != 0) { - ErrorF("i965_get_vb_space(): couldn't map vb\n"); - return NULL; - } - drm_intel_bo_reference(render_state->vertex_buffer_bo); return render_state->vertex_buffer_bo; } @@ -1416,7 +1410,7 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, float src_x[3], src_y[3], src_w[3], mask_x[3], mask_y[3], mask_w[3]; int i; drm_intel_bo *vb_bo; - float *vb; + float vb[18]; Bool is_affine = render_state->composite_op.is_affine; if (is_affine) @@ -1492,8 +1486,7 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, vb_bo = i965_get_vb_space(pScrn); if (vb_bo == NULL) return; - vb = vb_bo->virtual; - i = render_state->vb_offset; + i = 0; /* rect (x2,y2) */ vb[i++] = (float)(dstX + w); vb[i++] = (float)(dstY + h); @@ -1536,7 +1529,7 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, vb[i++] = mask_w[0]; } assert (i <= VERTEX_BUFFER_SIZE); - drm_intel_bo_unmap(vb_bo); + drm_intel_bo_subdata(vb_bo, render_state->vb_offset * 4, i * 4, vb); if (!i965_composite_check_aperture(pScrn)) intel_batch_flush(pScrn, FALSE); @@ -1568,7 +1561,7 @@ i965_composite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, OUT_BATCH(0); /* index buffer offset, ignored */ ADVANCE_BATCH(); - render_state->vb_offset = i; + render_state->vb_offset += i; drm_intel_bo_unreference(vb_bo); intel_batch_end_atomic(pScrn); |