Remove mentions of EGL_ANDROID_image_crop
This extension was initially a hack to fix a hardware problem on the
Nexus 4. It is undocumented and no current hardware implements it in
its EGL driver. Remove all code that interacts with it.
Bug: b/15287899
Test: Pixel XL boots
Change-Id: I28d4899537a587dda694feb11eaf3e7c7a2ab0a5
diff --git a/services/surfaceflinger/RenderEngine/Image.cpp b/services/surfaceflinger/RenderEngine/Image.cpp
index 0d06422..6e0a880 100644
--- a/services/surfaceflinger/RenderEngine/Image.cpp
+++ b/services/surfaceflinger/RenderEngine/Image.cpp
@@ -33,11 +33,10 @@
Image::Image(const RenderEngine& engine) : mEGLDisplay(engine.getEGLDisplay()) {}
Image::~Image() {
- setNativeWindowBuffer(nullptr, false, 0, 0);
+ setNativeWindowBuffer(nullptr, false);
}
-static std::vector<EGLint> buildAttributeList(bool isProtected, int32_t cropWidth,
- int32_t cropHeight) {
+static std::vector<EGLint> buildAttributeList(bool isProtected) {
std::vector<EGLint> attrs;
attrs.reserve(16);
@@ -49,24 +48,12 @@
attrs.push_back(EGL_TRUE);
}
- if (cropWidth > 0 && cropHeight > 0) {
- attrs.push_back(EGL_IMAGE_CROP_LEFT_ANDROID);
- attrs.push_back(0);
- attrs.push_back(EGL_IMAGE_CROP_TOP_ANDROID);
- attrs.push_back(0);
- attrs.push_back(EGL_IMAGE_CROP_RIGHT_ANDROID);
- attrs.push_back(cropWidth);
- attrs.push_back(EGL_IMAGE_CROP_BOTTOM_ANDROID);
- attrs.push_back(cropHeight);
- }
-
attrs.push_back(EGL_NONE);
return attrs;
}
-bool Image::setNativeWindowBuffer(ANativeWindowBuffer* buffer, bool isProtected, int32_t cropWidth,
- int32_t cropHeight) {
+bool Image::setNativeWindowBuffer(ANativeWindowBuffer* buffer, bool isProtected) {
if (mEGLImage != EGL_NO_IMAGE_KHR) {
if (!eglDestroyImageKHR(mEGLDisplay, mEGLImage)) {
ALOGE("failed to destroy image: %#x", eglGetError());
@@ -75,7 +62,7 @@
}
if (buffer) {
- std::vector<EGLint> attrs = buildAttributeList(isProtected, cropWidth, cropHeight);
+ std::vector<EGLint> attrs = buildAttributeList(isProtected);
mEGLImage = eglCreateImageKHR(mEGLDisplay, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID,
static_cast<EGLClientBuffer>(buffer), attrs.data());
if (mEGLImage == EGL_NO_IMAGE_KHR) {