From: Chia-I Wu Date: Thu, 18 Jun 2009 05:42:24 +0000 (+0800) Subject: intel: Do not access pbo's buffer directly when attaching. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cca30245bd6a5a713f0dc3278c37d9bd1f726e72;p=mesa.git 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 Signed-off-by: Eric Anholt --- diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 857e5ba85f1..e142020d169 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; }