Merge "db845c: gralloc_gbm: Handle null crop values" am: 7695cae89e am: d002abaf0f am: 71f1bb42ce am: 761e3994ad

Change-Id: I52a1580499eaf79a63422aa93ec3e3e8a0fb8d44
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 */