[Mesa-dev] [PATCH 8/9 v2] intel driver: add tiling support for intel_image_write() all drm image are supported for write
Zhao Halley
halley.zhao at intel.com
Tue Jun 5 10:08:51 CEST 2012
---
src/mesa/drivers/dri/intel/intel_screen.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c
index 3b8f81e..63b6b24 100755
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -310,10 +310,13 @@ intel_create_image(__DRIscreen *screen,
tiling = I915_TILING_NONE;
}
+#if 0
+ // add tiling support in intel_image_write(), so all drm images are ok for write
/* We only support write for cursor drm images */
if ((use & __DRI_IMAGE_USE_WRITE) &&
use != (__DRI_IMAGE_USE_WRITE | __DRI_IMAGE_USE_CURSOR))
return NULL;
+#endif
image = CALLOC(sizeof *image);
if (image == NULL)
@@ -441,9 +444,19 @@ intel_image_write(__DRIimage *image, const void *buf, size_t count)
if (!(image->usage & __DRI_IMAGE_USE_WRITE))
return -1;
- drm_intel_bo_map(image->region->bo, true);
+ int tiling, swizzle;
+ dri_bo_get_tiling(image->region->bo, &tiling, &swizzle);
+ if (tiling != I915_TILING_NONE)
+ drm_intel_gem_bo_map_gtt(image->region->bo);
+ else
+ dri_bo_map(image->region->bo, 1);
+
memcpy(image->region->bo->virtual, buf, count);
- drm_intel_bo_unmap(image->region->bo);
+
+ if (tiling != I915_TILING_NONE)
+ drm_intel_gem_bo_unmap_gtt(image->region->bo);
+ else
+ dri_bo_unmap(image->region->bo);
return 0;
}
--
1.7.5.4
More information about the mesa-dev
mailing list