RE-on-SK The First Steps

Lots of stuff is broken, but it puts things on screen

Test: enable via setprop, force gpu comp
Bug: 164223050
Change-Id: I443f751f5db95fbe9f4ee9294e3bace6e213545e
diff --git a/services/surfaceflinger/CompositionEngine/src/RenderSurface.cpp b/services/surfaceflinger/CompositionEngine/src/RenderSurface.cpp
index 2773fd3..8d1ffe3 100644
--- a/services/surfaceflinger/CompositionEngine/src/RenderSurface.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/RenderSurface.cpp
@@ -42,6 +42,9 @@
 // TODO(b/129481165): remove the #pragma below and fix conversion issues
 #pragma clang diagnostic pop // ignored "-Wconversion"
 
+// Uncomment to enable RE-SK workarounds; b/b/168499446
+//#define USE_SKIA_WORKAROUNDS
+
 namespace android::compositionengine {
 
 RenderSurface::~RenderSurface() = default;
@@ -81,7 +84,11 @@
     ALOGE_IF(status != NO_ERROR, "Unable to connect BQ producer: %d", status);
     status = native_window_set_buffers_format(window, HAL_PIXEL_FORMAT_RGBA_8888);
     ALOGE_IF(status != NO_ERROR, "Unable to set BQ format to RGBA888: %d", status);
+#ifdef USE_SKIA_WORKAROUNDS
+    status = native_window_set_usage(window, GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE);
+#else
     status = native_window_set_usage(window, GRALLOC_USAGE_HW_RENDER);
+#endif
     ALOGE_IF(status != NO_ERROR, "Unable to set BQ usage bits for GPU rendering: %d", status);
 }
 
@@ -113,6 +120,9 @@
     if (useProtected) {
         usageFlags |= GRALLOC_USAGE_PROTECTED;
     }
+#ifdef USE_SKIA_WORKAROUNDS
+    usageFlags |= GRALLOC_USAGE_HW_TEXTURE;
+#endif
     const int status = native_window_set_usage(mNativeWindow.get(), usageFlags);
     ALOGE_IF(status != NO_ERROR, "Unable to set BQ usage bits for protected content: %d", status);
     if (status == NO_ERROR) {