Fix error check for surface type in setSurface Check was overly restrictive and would generate errors for U8_4 buffers if KIND was not RGBA. Also no error would be reported. Change-Id: I7c032f2354a58178ad164fca6e9a0edf680b8316
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp index aac4f1d..196f969 100644 --- a/driver/rsdAllocation.cpp +++ b/driver/rsdAllocation.cpp
@@ -767,9 +767,13 @@ int format = 0; const Element *e = alloc->mHal.state.type->getElement(); - rsAssert(e->getType() == RS_TYPE_UNSIGNED_8); - rsAssert(e->getVectorSize() == 4); - rsAssert(e->getKind() == RS_KIND_PIXEL_RGBA); + if ((e->getType() != RS_TYPE_UNSIGNED_8) || + (e->getVectorSize() != 4)) { + // We do not check for RGBA, RGBx, to allow for interop with U8_4 + + rsc->setError(RS_ERROR_DRIVER, "Surface passed to setSurface is not U8_4, RGBA."); + goto error; + } format = PIXEL_FORMAT_RGBA_8888; r = native_window_set_buffers_format(nw, format);