summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-06-18 13:42:24 +0800
committerEric Anholt <eric@anholt.net>2009-06-19 16:43:45 -0700
commitcca30245bd6a5a713f0dc3278c37d9bd1f726e72 (patch)
tree74d52d855e75c556a6d1a9a346f0c97d075b7f13
parented91389618d05a3f660b34e0bac4be08134af6b7 (diff)
intel: Do not access pbo's buffer directly when attaching.
pbo might be system buffer based or attached to another region. Call intel_bufferobj_buffer to make sure pbo has a buffer of its own. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r--src/mesa/drivers/dri/intel/intel_regions.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c
index 857e5ba85f..e142020d16 100644
--- a/src/mesa/drivers/dri/intel/intel_regions.c
+++ b/src/mesa/drivers/dri/intel/intel_regions.c
@@ -427,6 +427,8 @@ intel_region_attach_pbo(struct intel_context *intel,
struct intel_region *region,
struct intel_buffer_object *pbo)
{
+ dri_bo *buffer;
+
if (region->pbo == pbo)
return;
@@ -447,10 +449,13 @@ intel_region_attach_pbo(struct intel_context *intel,
region->buffer = NULL;
}
+ /* make sure pbo has a buffer of its own */
+ buffer = intel_bufferobj_buffer(intel, pbo, INTEL_WRITE_FULL);
+
region->pbo = pbo;
region->pbo->region = region;
- dri_bo_reference(pbo->buffer);
- region->buffer = pbo->buffer;
+ dri_bo_reference(buffer);
+ region->buffer = buffer;
}