On 04/24/2017 01:52 PM, Emil Velikov wrote:
Hi Ben,
Just realised that the CrOS team might be interested in this as well -
adding Tomasz.
On 21 April 2017 at 18:17, Ben Widawsky <b...@bwidawsk.net> wrote:
Could do smarter stuff with the mappings. I decided not to.
Tested with kmscube. No current clients seem to use non-zero x0, y0, so
that's untested.
Cc: Tapani Pälli <tapani.pa...@intel.com> (AndroidIA?)
Tomasz, Tapani,
With this in place you should be able to drop the [patched] 3.3Kloc
drm_gralloc in favour of the 0.6Kloc gbm_gralloc [1].
Latter is what the cool kids are using ;-)
Android-IA has switched to use minigbm as allocator at one point. BTW
which project uses gbm_gralloc?
[1] https://github.com/robherring/gbm_gralloc
Cc: Emil Velikov <emil.veli...@collabora.com>
Signed-off-by: Ben Widawsky <b...@bwidawsk.net>
---
src/mesa/drivers/dri/i965/intel_screen.c | 39 ++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c
b/src/mesa/drivers/dri/i965/intel_screen.c
index 34a5f18af2..f89de3c9d4 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -926,6 +926,41 @@ intel_from_planar(__DRIimage *parent, int plane, void
*loaderPrivate)
return image;
}
+static void *
+intel_map_image(__DRIcontext *context, __DRIimage *image,
+ int x0, int y0, int width, int height,
+ unsigned int flags, int *stride, void **data)
+{
+ if (!image || !data || *data)
+ return NULL;
+
+ /* FIXME: add width/height check */
+
+ brw_bo_reference(image->bo);
+
+ uintptr_t offset =
+ y0 * image->pitch + x0 * _mesa_get_format_bytes(image->format);
+ void *bo_map = brw_bo_map__wc(image->bo);
+
+ if (bo_map) {
+ *data = image->bo;
+ *stride = image->pitch;
+ } else {
+ *data = NULL;
+ *stride = 0;
We shouldn't be touching these if the function fails.
+ brw_bo_unreference(image->bo);
Please explicitly return NULL here, since offset can be non-zero
should brw_bo_map__wc() fail.
+ }
+
+ return bo_map + offset;
Thanks
Emil
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev