OSDN Git Service

Proper comment on the usage mode in gralloc_alloc
authorbohu <bohu@google.com>
Mon, 2 Feb 2015 18:17:40 +0000 (10:17 -0800)
committerbohu <bohu@google.com>
Mon, 2 Feb 2015 18:45:36 +0000 (10:45 -0800)
Original usage validation is invalid for screen capture mode.
This CL removes the dead code and clarify the comment.

Change-Id: Ic14c1482aa431993f10e8ae1133e6513809b6606

system/gralloc/gralloc.cpp

index d74af08..059bf12 100644 (file)
@@ -136,17 +136,11 @@ static int gralloc_alloc(alloc_device_t* dev,
     }
 
     //
-    // Validate usage: buffer cannot be written both by s/w and h/w access.
+    // Note: in screen capture mode, both sw_write and hw_write will be on
+    // and this is a valid usage
     //
     bool sw_write = (0 != (usage & GRALLOC_USAGE_SW_WRITE_MASK));
     bool hw_write = (usage & GRALLOC_USAGE_HW_RENDER);
-    if (hw_write && sw_write) {
-        // screen-capture has both hw_write and sw_write enabled, and we
-        // should allow this usage.
-        // ALOGE("gralloc_alloc: Mismatched usage flags: %d x %d, usage %x",
-        //         w, h, usage);
-        // return -EINVAL;
-    }
     bool sw_read = (0 != (usage & GRALLOC_USAGE_SW_READ_MASK));
     bool hw_cam_write = usage & GRALLOC_USAGE_HW_CAMERA_WRITE;
     bool hw_cam_read = usage & GRALLOC_USAGE_HW_CAMERA_READ;