OSDN Git Service

Fix mapping for non-zero starting coordinates
authorRob Herring <robh@kernel.org>
Tue, 13 Dec 2016 15:37:06 +0000 (09:37 -0600)
committerRob Herring <robh@kernel.org>
Tue, 13 Dec 2016 15:44:56 +0000 (09:44 -0600)
While the gralloc API allows for specifying the starting coordinates (L,T),
it seems this doesn't really work. No other gralloc implementations found
use the rectangle bounds. Not exactly sure how this ever worked, but it
broke recently with AOSP master.

Signed-off-by: Rob Herring <robh@kernel.org>
gralloc_gbm.cpp

index 7e0dbda..6b7c0b5 100644 (file)
@@ -227,8 +227,8 @@ static int gbm_map(struct gralloc_gbm_bo_t *bo, int x, int y, int w, int h,
        if (enable_write)
                flags |= GBM_BO_TRANSFER_WRITE;
 
-       *addr = gbm_bo_map(bo->bo, x, y, w, h, flags, &stride, &bo->map_data);
-       ALOGE("mapped bo %p at %p", bo, *addr);
+       *addr = gbm_bo_map(bo->bo, 0, 0, x + w, y + h, flags, &stride, &bo->map_data);
+       ALOGE("mapped bo %p (%d, %d)-(%d, %d) at %p", bo, x, y, w, h, *addr);
        if (*addr == NULL)
                return -ENOMEM;