Merge changes I828a75fd,Idcb80ad9,Id7dbc0e1,Ic55a0b22

* changes:
  Move private fields from cb_handle_t to cb_handle_30_t
  Reland: Move `stride` into `cb_handle_t` from `cb_handle_30_t`
  Remove the CAMERA_x usage checks from our gralloc
  Remove `PixelFormat::IMPLEMENTATION_DEFINED` from our gralloc
diff --git a/shared/gralloc_cb/include/gralloc_cb_bp.h b/shared/gralloc_cb/include/gralloc_cb_bp.h
index e78b8fa..77e3706 100644
--- a/shared/gralloc_cb/include/gralloc_cb_bp.h
+++ b/shared/gralloc_cb/include/gralloc_cb_bp.h
@@ -33,47 +33,22 @@
                 QEMU_PIPE_HANDLE p_hostHandleRefCountFd,
                 uint32_t p_magic,
                 uint32_t p_hostHandle,
-                int32_t p_usage,
-                int32_t p_width,
-                int32_t p_height,
                 int32_t p_format,
-                int32_t p_glFormat,
-                int32_t p_glType,
+                uint32_t p_stride,
                 uint32_t p_bufSize,
-                void* p_bufPtr,
                 uint64_t p_mmapedOffset)
         : bufferFd(p_bufferFd),
           hostHandleRefCountFd(p_hostHandleRefCountFd),
           magic(p_magic),
           hostHandle(p_hostHandle),
-          usage(p_usage),
-          width(p_width),
-          height(p_height),
           format(p_format),
-          glFormat(p_glFormat),
-          glType(p_glType),
           bufferSize(p_bufSize),
+          stride(p_stride),
           mmapedOffsetLo(static_cast<uint32_t>(p_mmapedOffset)),
-          mmapedOffsetHi(static_cast<uint32_t>(p_mmapedOffset >> 32)),
-          lockedLeft(0),
-          lockedTop(0),
-          lockedWidth(0),
-          lockedHeight(0) {
+          mmapedOffsetHi(static_cast<uint32_t>(p_mmapedOffset >> 32)) {
         version = sizeof(native_handle);
         numFds = ((bufferFd >= 0) ? 1 : 0) + (qemu_pipe_valid(hostHandleRefCountFd) ? 1 : 0);
         numInts = 0; // has to be overwritten in children classes
-        setBufferPtr(p_bufPtr);
-    }
-
-    void* getBufferPtr() const {
-        const uint64_t addr = (uint64_t(bufferPtrHi) << 32) | bufferPtrLo;
-        return reinterpret_cast<void*>(static_cast<uintptr_t>(addr));
-    }
-
-    void setBufferPtr(void* ptr) {
-        const uint64_t addr = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(ptr));
-        bufferPtrLo = uint32_t(addr);
-        bufferPtrHi = uint32_t(addr >> 32);
     }
 
     uint64_t getMmapedOffset() const {
@@ -81,7 +56,7 @@
     }
 
     uint32_t allocatedSize() const {
-        return getBufferPtr() ? bufferSize : 0;
+        return bufferSize;
     }
 
     bool isValid() const {
@@ -110,21 +85,11 @@
     // ints
     uint32_t magic;         // magic number in order to validate a pointer
     uint32_t hostHandle;    // the host reference to this buffer
-    int32_t  usage;         // usage bits the buffer was created with
-    int32_t  width;         // buffer width
-    int32_t  height;        // buffer height
-    int32_t  format;        // real internal pixel format format
-    int32_t  glFormat;      // OpenGL format enum used for host h/w color buffer
-    int32_t  glType;        // OpenGL type enum used when uploading to host
-    uint32_t bufferSize;    // buffer size and location
-    uint32_t bufferPtrLo;
-    uint32_t bufferPtrHi;
+    uint32_t format;        // real internal pixel format format
+    uint32_t bufferSize;
+    uint32_t stride;
     uint32_t mmapedOffsetLo;
     uint32_t mmapedOffsetHi;
-    int32_t  lockedLeft;    // region of buffer locked for s/w write
-    int32_t  lockedTop;
-    int32_t  lockedWidth;
-    int32_t  lockedHeight;
 };
 
 #endif //__GRALLOC_CB_H__
diff --git a/system/gralloc/gralloc_30.cpp b/system/gralloc/gralloc_30.cpp
index 298842f..4fb31cf 100644
--- a/system/gralloc/gralloc_30.cpp
+++ b/system/gralloc/gralloc_30.cpp
@@ -70,6 +70,93 @@
 
 namespace {
 
+template <class T> T& unconst(const T& x) { return const_cast<T&>(x); }
+
+const uint32_t CB_HANDLE_MAGIC_30 = CB_HANDLE_MAGIC_BASE | 0x2;
+
+struct cb_handle_30_t : public cb_handle_t {
+    cb_handle_30_t(address_space_handle_t p_bufferFd,
+                   QEMU_PIPE_HANDLE p_hostHandleRefCountFd,
+                   uint32_t p_hostHandle,
+                   int32_t p_usage,
+                   int32_t p_width,
+                   int32_t p_height,
+                   int32_t p_format,
+                   int32_t p_glFormat,
+                   int32_t p_glType,
+                   uint32_t p_stride,
+                   uint32_t p_bufSize,
+                   void* p_bufPtr,
+                   int32_t p_bufferPtrPid,
+                   uint32_t p_mmapedSize,
+                   uint64_t p_mmapedOffset)
+            : cb_handle_t(p_bufferFd,
+                          p_hostHandleRefCountFd,
+                          CB_HANDLE_MAGIC_30,
+                          p_hostHandle,
+                          p_format,
+                          p_stride,
+                          p_bufSize,
+                          p_mmapedOffset),
+              usage(p_usage),
+              width(p_width),
+              height(p_height),
+              glFormat(p_glFormat),
+              glType(p_glType),
+              mmapedSize(p_mmapedSize),
+              bufferFdAsInt(p_bufferFd),
+              bufferPtrPid(p_bufferPtrPid),
+              lockedLeft(0),
+              lockedTop(0),
+              lockedWidth(0),
+              lockedHeight(0) {
+        numInts = CB_HANDLE_NUM_INTS(numFds);
+        setBufferPtr(p_bufPtr);
+    }
+
+    bool isValid() const { return (version == sizeof(native_handle_t)) && (magic == CB_HANDLE_MAGIC_30); }
+
+    void* getBufferPtr() const {
+        const uint64_t addr = (uint64_t(bufferPtrHi) << 32) | bufferPtrLo;
+        return reinterpret_cast<void*>(static_cast<uintptr_t>(addr));
+    }
+
+    void setBufferPtr(void* ptr) {
+        const uint64_t addr = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(ptr));
+        bufferPtrLo = uint32_t(addr);
+        bufferPtrHi = uint32_t(addr >> 32);
+    }
+
+    static cb_handle_30_t* from(void* p) {
+        if (!p) { return nullptr; }
+        cb_handle_30_t* cb = static_cast<cb_handle_30_t*>(p);
+        return cb->isValid() ? cb : nullptr;
+    }
+
+    static const cb_handle_30_t* from(const void* p) {
+        return from(const_cast<void*>(p));
+    }
+
+    static cb_handle_30_t* from_unconst(const void* p) {
+        return from(const_cast<void*>(p));
+    }
+
+    uint32_t usage;         // usage bits the buffer was created with
+    uint32_t width;         // buffer width
+    uint32_t height;        // buffer height
+    uint32_t glFormat;      // OpenGL format enum used for host h/w color buffer
+    uint32_t glType;        // OpenGL type enum used when uploading to host
+    uint32_t mmapedSize;    // real allocation side
+    int32_t  bufferFdAsInt; // int copy of bufferFd, to check if fd was duped
+    int32_t  bufferPtrPid;  // pid where bufferPtr belongs to
+    uint32_t lockedLeft;    // region of buffer locked for s/w write
+    uint32_t lockedTop;
+    uint32_t lockedWidth;
+    uint32_t lockedHeight;
+    uint32_t bufferPtrLo;
+    uint32_t bufferPtrHi;
+};
+
 const char GOLDFISH_GRALLOC_MODULE_NAME[] = "Graphics Memory Allocator Module";
 
 hw_device_t make_hw_device(hw_module_t* module, int (*close)(hw_device_t*)) {
@@ -138,7 +225,7 @@
                              int width, int height, int format,
                              EmulatorFrameworkFormat emulatorFrameworkFormat,
                              int glFormat, int glType,
-                             size_t bufferSize,
+                             size_t stride, size_t bufferSize,
                              buffer_handle_t* pHandle) = 0;
     virtual int free_buffer(buffer_handle_t h) = 0;
     virtual int register_buffer(buffer_handle_t h) = 0;
@@ -165,13 +252,13 @@
                      int width, int height, int format,
                      EmulatorFrameworkFormat emulatorFrameworkFormat,
                      int glFormat, int glType,
-                     size_t bufferSize,
+                     size_t stride, size_t bufferSize,
                      buffer_handle_t* pHandle) {
         return m_bufferManager->alloc_buffer(usage,
                                              width, height, format,
                                              emulatorFrameworkFormat,
                                              glFormat, glType,
-                                             bufferSize,
+                                             stride, bufferSize,
                                              pHandle);
     }
 
@@ -187,7 +274,7 @@
         return m_bufferManager->unregister_buffer(h);
     }
 
-    int lock(cb_handle_t& handle,
+    int lock(cb_handle_30_t& handle,
              const int usage,
              const int left, const int top, const int width, const int height,
              void** vaddr) {
@@ -207,7 +294,7 @@
         return 0;
     }
 
-    int unlock(cb_handle_t& handle) {
+    int unlock(cb_handle_30_t& handle) {
         if (!handle.bufferSize) { RETURN_ERROR_CODE(-EINVAL); }
 
         char* const bufferBits = static_cast<char*>(handle.getBufferPtr());
@@ -220,7 +307,7 @@
         return 0;
     }
 
-    int lock_ycbcr(cb_handle_t& handle,
+    int lock_ycbcr(cb_handle_30_t& handle,
                    const int usage,
                    const int left, const int top, const int width, const int height,
                    android_ycbcr* ycbcr) {
@@ -286,7 +373,7 @@
     }
 
 private:
-    int lock_impl(cb_handle_t& handle,
+    int lock_impl(cb_handle_30_t& handle,
                   const int usage,
                   const int left, const int top, const int width, const int height,
                   char* const bufferBits) {
@@ -378,7 +465,7 @@
         return 0;
     }
 
-    void unlock_impl(cb_handle_t& handle, char* const bufferBits) {
+    void unlock_impl(cb_handle_30_t& handle, char* const bufferBits) {
         const int bpp = glUtilsPixelBitSize(handle.glFormat, handle.glType) >> 3;
         const int left = handle.lockedLeft;
         const int top = handle.lockedTop;
@@ -653,7 +740,7 @@
             width, height, format,
             emulatorFrameworkFormat,
             glFormat, glType,
-            bufferSize,
+            stride, bufferSize,
             pHandle);
         if (res) {
             return res;
@@ -718,65 +805,6 @@
     }
 };
 
-template <class T> T& unconst(const T& x) { return const_cast<T&>(x); }
-
-const uint32_t CB_HANDLE_MAGIC_30 = CB_HANDLE_MAGIC_BASE | 0x2;
-
-struct cb_handle_30_t : public cb_handle_t {
-    cb_handle_30_t(address_space_handle_t p_bufferFd,
-                   QEMU_PIPE_HANDLE p_hostHandleRefCountFd,
-                   uint32_t p_hostHandle,
-                   int32_t p_usage,
-                   int32_t p_width,
-                   int32_t p_height,
-                   int32_t p_format,
-                   int32_t p_glFormat,
-                   int32_t p_glType,
-                   uint32_t p_bufSize,
-                   void* p_bufPtr,
-                   int32_t p_bufferPtrPid,
-                   uint32_t p_mmapedSize,
-                   uint64_t p_mmapedOffset)
-            : cb_handle_t(p_bufferFd,
-                          p_hostHandleRefCountFd,
-                          CB_HANDLE_MAGIC_30,
-                          p_hostHandle,
-                          p_usage,
-                          p_width,
-                          p_height,
-                          p_format,
-                          p_glFormat,
-                          p_glType,
-                          p_bufSize,
-                          p_bufPtr,
-                          p_mmapedOffset),
-              bufferFdAsInt(p_bufferFd),
-              bufferPtrPid(p_bufferPtrPid),
-              mmapedSize(p_mmapedSize) {
-        numInts = CB_HANDLE_NUM_INTS(numFds);
-    }
-
-    bool isValid() const { return (version == sizeof(native_handle_t)) && (magic == CB_HANDLE_MAGIC_30); }
-
-    static cb_handle_30_t* from(void* p) {
-        if (!p) { return nullptr; }
-        cb_handle_30_t* cb = static_cast<cb_handle_30_t*>(p);
-        return cb->isValid() ? cb : nullptr;
-    }
-
-    static const cb_handle_30_t* from(const void* p) {
-        return from(const_cast<void*>(p));
-    }
-
-    static cb_handle_30_t* from_unconst(const void* p) {
-        return from(const_cast<void*>(p));
-    }
-
-    int32_t  bufferFdAsInt;         // int copy of bufferFd, to check if fd was duped
-    int32_t  bufferPtrPid;          // pid where bufferPtr belongs to
-    uint32_t mmapedSize;            // real allocation side
-};
-
 // goldfish_address_space_host_malloc_handle_manager_t uses
 // GoldfishAddressSpaceHostMemoryAllocator and GoldfishAddressSpaceBlock
 // to allocate buffers on the host.
@@ -804,7 +832,7 @@
                      int width, int height, int format,
                      EmulatorFrameworkFormat emulatorFrameworkFormat,
                      int glFormat, int glType,
-                     size_t bufferSize,
+                     size_t stride, size_t bufferSize,
                      buffer_handle_t* pHandle) override {
         const HostConnectionSession conn = m_gr->getHostConnectionSession();
         ExtendedRCEncoderContext *const rcEnc = conn.getRcEncoder();
@@ -846,7 +874,7 @@
                 hostHandle,
                 usage, width, height,
                 format, glFormat, glType,
-                bufferSize, bufferBits.guestPtr(), getpid(),
+                stride, bufferSize, bufferBits.guestPtr(), getpid(),
                 bufferBits.size(), bufferBits.offset());
         bufferBits.release();
 
@@ -988,7 +1016,7 @@
         RETURN_ERROR_CODE(-EINVAL);
     }
 
-    cb_handle_t* handle = cb_handle_t::from_unconst(bh);
+    cb_handle_30_t* handle = cb_handle_30_t::from_unconst(bh);
     if (!handle) {
         RETURN_ERROR_CODE(-EINVAL);
     }
@@ -1002,7 +1030,7 @@
         RETURN_ERROR_CODE(-EINVAL);
     }
 
-    cb_handle_t* handle = cb_handle_t::from_unconst(bh);
+    cb_handle_30_t* handle = cb_handle_30_t::from_unconst(bh);
     if (!handle) {
         RETURN_ERROR_CODE(-EINVAL);
     }
@@ -1019,7 +1047,7 @@
         RETURN_ERROR_CODE(-EINVAL);
     }
 
-    cb_handle_t* handle = cb_handle_t::from_unconst(bh);
+    cb_handle_30_t* handle = cb_handle_30_t::from_unconst(bh);
     if (!handle) {
         RETURN_ERROR_CODE(-EINVAL);
     }
diff --git a/system/gralloc/gralloc_old.cpp b/system/gralloc/gralloc_old.cpp
index d742ef7..dd054d5 100644
--- a/system/gralloc/gralloc_old.cpp
+++ b/system/gralloc/gralloc_old.cpp
@@ -91,17 +91,23 @@
                           QEMU_PIPE_INVALID_HANDLE,
                           CB_HANDLE_MAGIC_OLD,
                           0,
-                          p_usage,
-                          p_width,
-                          p_height,
                           p_format,
-                          p_glFormat,
-                          p_glType,
+                          p_width,
                           p_ashmemSize,
-                          NULL,
                           ~uint64_t(0)),
+              usage(p_usage),
+              width(p_width),
+              height(p_height),
+              glFormat(p_glFormat),
+              glType(p_glType),
               ashmemBasePid(0),
-              mappedPid(0) {
+              mappedPid(0),
+              bufferPtrLo(0),
+              bufferPtrHi(0),
+              lockedLeft(0),
+              lockedTop(0),
+              lockedWidth(0),
+              lockedHeight(0) {
         numInts = CB_HANDLE_NUM_INTS(numFds);
     }
 
@@ -121,6 +127,17 @@
         return (0 != (usage & GRALLOC_USAGE_HW_FB));
     }
 
+    void* getBufferPtr() const {
+        const uint64_t addr = (uint64_t(bufferPtrHi) << 32) | bufferPtrLo;
+        return reinterpret_cast<void*>(static_cast<uintptr_t>(addr));
+    }
+
+    void setBufferPtr(void* ptr) {
+        const uint64_t addr = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(ptr));
+        bufferPtrLo = uint32_t(addr);
+        bufferPtrHi = uint32_t(addr >> 32);
+    }
+
     bool isValid() const {
         return (version == sizeof(native_handle)) && (magic == CB_HANDLE_MAGIC_OLD);
     }
@@ -139,8 +156,19 @@
         return from(const_cast<void*>(p));
     }
 
+    uint32_t usage;         // usage bits the buffer was created with
+    uint32_t width;         // buffer width
+    uint32_t height;        // buffer height
+    uint32_t glFormat;      // OpenGL format enum used for host h/w color buffer
+    uint32_t glType;        // OpenGL type enum used when uploading to host
     int32_t ashmemBasePid;      // process id which mapped the ashmem region
     int32_t mappedPid;          // process id which succeeded gralloc_register call
+    uint32_t bufferPtrLo;
+    uint32_t bufferPtrHi;
+    uint32_t lockedLeft;    // region of buffer locked for s/w write
+    uint32_t lockedTop;
+    uint32_t lockedWidth;
+    uint32_t lockedHeight;
 };
 
 int32_t* getOpenCountPtr(const cb_handle_old_t* cb) {
diff --git a/system/hals/allocator3.cpp b/system/hals/allocator3.cpp
index b968d7f..e33d5fd 100644
--- a/system/hals/allocator3.cpp
+++ b/system/hals/allocator3.cpp
@@ -93,8 +93,6 @@
         const uint32_t usage = descriptor.usage;
         const bool usageSwWrite = usage & BufferUsage::CPU_WRITE_MASK;
         const bool usageSwRead = usage & BufferUsage::CPU_READ_MASK;
-        const bool usageHwCamWrite = usage & BufferUsage::CAMERA_OUTPUT;
-        const bool usageHwCamRead = usage & BufferUsage::CAMERA_INPUT;
 
         int bpp = 1;
         int glFormat = 0;
@@ -156,7 +154,7 @@
         case PixelFormat::Y16:
             bpp = 2;
             align = 16 * bpp;
-            if (!((usageSwRead || usageHwCamRead) && (usageSwWrite || usageHwCamWrite))) {
+            if (!(usageSwRead && usageSwWrite)) {
                 // Raw sensor data or Y16 only goes between camera and CPU
                 RETURN_ERROR(Error3::UNSUPPORTED);
             }
@@ -166,13 +164,6 @@
             break;
 
         case PixelFormat::BLOB:
-            if (!usageSwRead) {
-                // Blob data cannot be used by HW other than camera emulator
-                // But there is a CTS test trying to have access to it
-                // BUG: https://buganizer.corp.google.com/issues/37719518
-                RETURN_ERROR(Error3::UNSUPPORTED);
-            }
-            // Not expecting to actually create any GL surfaces for this
             glFormat = GL_LUMINANCE;
             glType = GL_UNSIGNED_BYTE;
             break;
@@ -290,21 +281,6 @@
                                   const uint32_t usage,
                                   PixelFormat* format) {
         if (frameworkFormat == PixelFormat::IMPLEMENTATION_DEFINED) {
-            if (usage & BufferUsage::CAMERA_OUTPUT) {
-                if (usage & BufferUsage::GPU_TEXTURE) {
-                    // Camera-to-display is RGBA
-                    *format = PixelFormat::RGBA_8888;
-                    RETURN(Error3::NONE);
-                } else if (usage & BufferUsage::VIDEO_ENCODER) {
-                    // Camera-to-encoder is NV21
-                    *format = PixelFormat::YCRCB_420_SP;
-                    RETURN(Error3::NONE);
-                } else {
-                    // b/189957071
-                    *format = PixelFormat::YCBCR_420_888;
-                    RETURN(Error3::NONE);
-                }
-            }
             RETURN_ERROR(Error3::UNSUPPORTED);
         } else if (static_cast<int>(frameworkFormat) == kOMX_COLOR_FormatYUV420Planar &&
                (usage & BufferUsage::VIDEO_DECODER)) {
diff --git a/system/hals/cb_handle_30.h b/system/hals/cb_handle_30.h
index 7e5e73d..161e0ed 100644
--- a/system/hals/cb_handle_30.h
+++ b/system/hals/cb_handle_30.h
@@ -23,15 +23,15 @@
 const uint32_t CB_HANDLE_MAGIC_30 = CB_HANDLE_MAGIC_BASE | 0x2;
 
 struct cb_handle_30_t : public cb_handle_t {
-    cb_handle_30_t(address_space_handle_t p_bufferFd,
+    cb_handle_30_t(int p_bufferFd,
                    QEMU_PIPE_HANDLE p_hostHandleRefCountFd,
                    uint32_t p_hostHandle,
-                   int32_t p_usage,
-                   int32_t p_width,
-                   int32_t p_height,
-                   int32_t p_format,
-                   int32_t p_glFormat,
-                   int32_t p_glType,
+                   uint32_t p_usage,
+                   uint32_t p_width,
+                   uint32_t p_height,
+                   uint32_t p_format,
+                   uint32_t p_glFormat,
+                   uint32_t p_glType,
                    uint32_t p_bufSize,
                    void* p_bufPtr,
                    uint32_t p_mmapedSize,
@@ -42,25 +42,40 @@
                           p_hostHandleRefCountFd,
                           CB_HANDLE_MAGIC_30,
                           p_hostHandle,
-                          p_usage,
-                          p_width,
-                          p_height,
                           p_format,
-                          p_glFormat,
-                          p_glType,
+                          p_stride,
                           p_bufSize,
-                          p_bufPtr,
                           p_mmapedOffset),
-              mmapedSize(p_mmapedSize),
+              usage(p_usage),
+              width(p_width),
+              height(p_height),
+              glFormat(p_glFormat),
+              glType(p_glType),
               bytesPerPixel(p_bytesPerPixel),
-              stride(p_stride),
+              mmapedSize(p_mmapedSize),
               locked(0),
-              lockedUsage(0) {
+              lockedUsage(0),
+              lockedLeft(0),
+              lockedTop(0),
+              lockedWidth(0),
+              lockedHeight(0) {
         numInts = CB_HANDLE_NUM_INTS(numFds);
+        setBufferPtr(p_bufPtr);
     }
 
     bool isValid() const { return (version == sizeof(native_handle_t)) && (magic == CB_HANDLE_MAGIC_30); }
 
+    void* getBufferPtr() const {
+        const uint64_t addr = (uint64_t(bufferPtrHi) << 32) | bufferPtrLo;
+        return reinterpret_cast<void*>(static_cast<uintptr_t>(addr));
+    }
+
+    void setBufferPtr(void* ptr) {
+        const uint64_t addr = static_cast<uint64_t>(reinterpret_cast<uintptr_t>(ptr));
+        bufferPtrLo = uint32_t(addr);
+        bufferPtrHi = uint32_t(addr >> 32);
+    }
+
     static cb_handle_30_t* from(void* p) {
         if (!p) { return nullptr; }
         cb_handle_30_t* cb = static_cast<cb_handle_30_t*>(p);
@@ -75,11 +90,21 @@
         return from(const_cast<void*>(p));
     }
 
-    uint32_t mmapedSize;            // real allocation side
+    uint32_t usage;         // usage bits the buffer was created with
+    uint32_t width;         // buffer width
+    uint32_t height;        // buffer height
+    uint32_t glFormat;      // OpenGL format enum used for host h/w color buffer
+    uint32_t glType;        // OpenGL type enum used when uploading to host
     uint32_t bytesPerPixel;
-    uint32_t stride;
+    uint32_t mmapedSize;    // real allocation side
+    uint32_t bufferPtrLo;
+    uint32_t bufferPtrHi;
     uint32_t locked;
     uint32_t lockedUsage;
+    uint32_t lockedLeft;    // region of buffer locked for s/w write
+    uint32_t lockedTop;
+    uint32_t lockedWidth;
+    uint32_t lockedHeight;
 };
 
 #endif // SYSTEM_HALS_CB_HANDLE_30_H
diff --git a/system/hals/mapper3.cpp b/system/hals/mapper3.cpp
index a14a0cd..9666566 100644
--- a/system/hals/mapper3.cpp
+++ b/system/hals/mapper3.cpp
@@ -387,8 +387,6 @@
                         char* const bufferBits) {
         const bool usageSwRead = usage & BufferUsage::CPU_READ_MASK;
         const bool usageSwWrite = usage & BufferUsage::CPU_WRITE_MASK;
-        const bool usageHwCamera = usage & (BufferUsage::CAMERA_INPUT | BufferUsage::CAMERA_OUTPUT);
-        const bool usageHwCameraWrite = usage & BufferUsage::CAMERA_OUTPUT;
 
         const HostConnectionSession conn = getHostConnectionSession();
         ExtendedRCEncoderContext *const rcEnc = conn.getRcEncoder();
@@ -399,10 +397,8 @@
             RETURN_ERROR(Error3::NO_RESOURCES);
         }
 
-        // camera delivers bits to the buffer directly and does not require
-        // an explicit read.
         const bool cbReadable = cb.usage & BufferUsage::CPU_READ_MASK;
-        if (usageSwRead && !usageHwCamera && cbReadable) {
+        if (usageSwRead && cbReadable) {
             if (gralloc_is_yuv_format(cb.format)) {
                 if (rcEnc->hasYUVCache()) {
                     uint32_t bufferSize;
@@ -474,7 +470,7 @@
             }
         }
 
-        if (usageSwWrite || usageHwCameraWrite) {
+        if (usageSwWrite) {
             cb.lockedLeft = accessRegion.left;
             cb.lockedTop = accessRegion.top;
             cb.lockedWidth = accessRegion.width;
@@ -595,8 +591,6 @@
         const uint32_t usage = usage64;
         const bool usageSwWrite = usage & BufferUsage::CPU_WRITE_MASK;
         const bool usageSwRead = usage & BufferUsage::CPU_READ_MASK;
-        const bool usageHwCamWrite = usage & BufferUsage::CAMERA_OUTPUT;
-        const bool usageHwCamRead = usage & BufferUsage::CAMERA_INPUT;
 
         switch (descriptor.format) {
         case PixelFormat::RGBA_8888:
@@ -611,9 +605,6 @@
             RETURN(true);
 
         case PixelFormat::IMPLEMENTATION_DEFINED:
-            if (usage & BufferUsage::CAMERA_OUTPUT) {
-                RETURN(true);
-            }
             RETURN(false);
 
         case PixelFormat::RGB_888:
@@ -624,8 +615,7 @@
 
         case PixelFormat::RAW16:
         case PixelFormat::Y16:
-            RETURN((usageSwRead || usageHwCamRead) &&
-                   (usageSwWrite || usageHwCamWrite));
+            RETURN(usageSwRead && usageSwWrite);
 
         case PixelFormat::BLOB:
             RETURN(usageSwRead);