[Mesa-dev] [PATCH 08/11 v5] intel driver: dri image write update
Zhao Halley
halley.zhao at intel.com
Sun Jul 8 22:55:17 PDT 2012
add tiling support for intel_image_write()
all drm image can be written from app
---
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 644ec5b..fa36a3f 100755
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -307,10 +307,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 = intel_allocate_image(format, loaderPrivate);
image->usage = use;
@@ -393,9 +396,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
+ drm_intel_bo_map(image->region->bo, true);
+
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
+ drm_intel_bo_unmap(image->region->bo);
return 0;
}
--
1.7.4.1
More information about the mesa-dev
mailing list