Always set usage bits for GPU comp in DisplayDevice.

* Always set GRALLOC_USAGE_HW_RENDER as usage bit
* Always use RGBA8888 buffer for the GPU to render to.

Otherwise, some virtual display sinks can request a YUV buffer, which
the GPU cannot render to.

Also add back in a connect call for the scratch buffer, since that
should not have been removed.

Bug: 117680609
Change-Id: Ia0c2e99db839ff681529c041a471242d25a8f743
Test: Simulating virtual displays
Test: adb shell screenrecord
Test: Chromecast display mirroring
Test: Simulating virtual displays while mirroring displays
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index d5b24ae..55ce434 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -288,8 +288,12 @@
 
     ANativeWindow* const window = mNativeWindow.get();
 
-    int status = native_window_api_connect(mNativeWindow.get(), NATIVE_WINDOW_API_EGL);
+    int status = native_window_api_connect(window, NATIVE_WINDOW_API_EGL);
     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);
+    status = native_window_set_usage(window, GRALLOC_USAGE_HW_RENDER);
+    ALOGE_IF(status != NO_ERROR, "Unable to set BQ usage bits for GPU rendering: %d", status);
 
     mDisplayWidth = ANativeWindow_getWidth(window);
     mDisplayHeight = ANativeWindow_getHeight(window);