Merge "db845c: gralloc_gbm: Handle null crop values" am: 7695cae89e am: d002abaf0f
Change-Id: If511746e267af1e2545fc60caffba9b0b7e99f8b
diff --git a/gralloc/gralloc_gbm.cpp b/gralloc/gralloc_gbm.cpp
index ab6c12b..43907e5 100644
--- a/gralloc/gralloc_gbm.cpp
+++ b/gralloc/gralloc_gbm.cpp
@@ -428,6 +428,15 @@
usage |= bo_data->locked_for;
+ /*
+ * Some users will lock with an null crop rect.
+ * Interpret this as no-crop (full buffer WxH).
+ */
+ if (w == 0 && h == 0) {
+ w = gbm_handle->width;
+ h = gbm_handle->height;
+ }
+
if (usage & (GRALLOC_USAGE_SW_WRITE_MASK |
GRALLOC_USAGE_SW_READ_MASK)) {
/* the driver is supposed to wait for the bo */