Add extra logs for egl config selection

To help debugging the issues from the logs.

Bug: 394610018
Test: CI
Change-Id: I59062994289afe9f3987ddbae3df5ec9be0b9b09
diff --git a/host/RenderControl.cpp b/host/RenderControl.cpp
index 353b275..b31ce7f 100644
--- a/host/RenderControl.cpp
+++ b/host/RenderControl.cpp
@@ -289,6 +289,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
 
@@ -740,6 +741,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
 
@@ -759,6 +761,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
     return fb->getDisplayConfigsParam(0, param);
@@ -769,6 +772,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
 
@@ -791,6 +795,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
 
@@ -801,6 +806,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        VERBOSE("%s: framebuffer cannot be found!", __func__);
         return;
     }
 
@@ -812,6 +818,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
 
@@ -825,6 +832,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
 
@@ -836,6 +844,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
     return fb->openColorBuffer( colorbuffer );
@@ -850,6 +859,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        VERBOSE("%s: framebuffer cannot be found!", __func__);
         return;
     }
     fb->closeColorBuffer( colorbuffer );
@@ -1047,6 +1057,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
 
@@ -1057,6 +1068,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        VERBOSE("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
 
@@ -1241,6 +1253,7 @@
 
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
     return fb->compose(bufferSize, buffer, true);
@@ -1252,6 +1265,7 @@
 
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
     return fb->compose(bufferSize, buffer, false);
@@ -1260,6 +1274,7 @@
 static int rcCreateDisplay(uint32_t* displayId) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1271,6 +1286,7 @@
 static int rcCreateDisplayById(uint32_t displayId) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1280,6 +1296,7 @@
 static int rcDestroyDisplay(uint32_t displayId) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1289,6 +1306,7 @@
 static int rcSetDisplayColorBuffer(uint32_t displayId, uint32_t colorBuffer) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1298,6 +1316,7 @@
 static int rcGetDisplayColorBuffer(uint32_t displayId, uint32_t* colorBuffer) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1307,6 +1326,7 @@
 static int rcGetColorBufferDisplay(uint32_t colorBuffer, uint32_t* displayId) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1320,6 +1340,7 @@
                             uint32_t* h) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1333,6 +1354,7 @@
                             uint32_t h) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1347,6 +1369,7 @@
                                uint32_t dpi) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1388,6 +1411,7 @@
 static uint32_t rcCreateBuffer2(uint64_t size, uint32_t memoryProperty) {
     FrameBuffer* fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return 0;
     }
 
@@ -1513,6 +1537,7 @@
 {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
 
@@ -1523,6 +1548,7 @@
 static int rcGetFBDisplayConfigsCount() {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
     return fb->getDisplayConfigsCount();
@@ -1531,6 +1557,7 @@
 static int rcGetFBDisplayConfigsParam(int configId, GLint param) {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
     return fb->getDisplayConfigsParam(configId, param);
@@ -1539,6 +1566,7 @@
 static int rcGetFBDisplayActiveConfig() {
     FrameBuffer *fb = FrameBuffer::getFB();
     if (!fb) {
+        WARN("%s: framebuffer cannot be found!", __func__);
         return -1;
     }
     return fb->getDisplayActiveConfig();
diff --git a/host/gl/EmulatedEglConfig.cpp b/host/gl/EmulatedEglConfig.cpp
index bd82a34..87b5f53 100644
--- a/host/gl/EmulatedEglConfig.cpp
+++ b/host/gl/EmulatedEglConfig.cpp
@@ -80,6 +80,7 @@
     s_egl.eglGetConfigAttrib(
             display, config, EGL_SURFACE_TYPE, &surfaceType);
     if (!(surfaceType & EGL_PBUFFER_BIT)) {
+        VERBOSE("%s:%d surfaceType=%d is not compatible", __func__, __LINE__, surfaceType);
         return false;
     }
 
@@ -92,6 +93,8 @@
     s_egl.eglGetConfigAttrib(
             display, config, EGL_BLUE_SIZE, &blueSize);
     if (!redSize || !greenSize || !blueSize) {
+        VERBOSE("%s:%d surfaceType=%d is not compatible, redSize=%d greenSize=%d blueSize=%d",
+                __func__, __LINE__, surfaceType, redSize, greenSize, blueSize);
         return false;
     }
 
diff --git a/host/gl/EmulatedEglConfig.h b/host/gl/EmulatedEglConfig.h
index ca6c98a..4fe4b41 100644
--- a/host/gl/EmulatedEglConfig.h
+++ b/host/gl/EmulatedEglConfig.h
@@ -24,6 +24,8 @@
 #include "OpenGLESDispatch/GLESv2Dispatch.h"
 #include "gfxstream/host/Features.h"
 
+#include "host-common/logging.h"
+
 namespace gfxstream {
 namespace gl {
 
@@ -127,6 +129,8 @@
         if (guestId >= 0 && guestId < (int)mConfigs.size()) {
             return &mConfigs[guestId];
         } else {
+            INFO("Requested invalid EGL config id: %d (list size: %d)", guestId,
+                 (int)mConfigs.size());
             return NULL;
         }
     }
diff --git a/host/gl/TextureDraw.cpp b/host/gl/TextureDraw.cpp
index 92b8c72..e3d99d2 100644
--- a/host/gl/TextureDraw.cpp
+++ b/host/gl/TextureDraw.cpp
@@ -55,12 +55,9 @@
         GLint infoLogLength;
         s_gles2.glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);
         std::string infoLog(infoLogLength + 1, '\0');
-        fprintf(stderr, "%s: TextureDraw shader compile failed.\n", __func__);
         s_gles2.glGetShaderInfoLog(shader, infoLogLength, 0, &infoLog[0]);
-        fprintf(stderr, "%s: Info log:\n%s\n", __func__,
-                infoLog.c_str());
-        fprintf(stderr, "%s: Source:\n%s\n", __func__,
-                shaderText);
+        ERR("%s: TextureDraw shader compile failed: \n%s", __func__, shaderText);
+        ERR("%s: Info log: %s", __func__, infoLog.c_str());
         s_gles2.glDeleteShader(shader);
 
         // No point in continuing as it's going to be a black screen.
diff --git a/host/gl/TextureResize.cpp b/host/gl/TextureResize.cpp
index 6c2f6f3..f1ab29a 100644
--- a/host/gl/TextureResize.cpp
+++ b/host/gl/TextureResize.cpp
@@ -34,8 +34,6 @@
 namespace gfxstream {
 namespace gl {
 
-// #define V(...)  VERBOSE_PRINT(gles,__VA_ARGS__)
-#define V(...)
 #define MAX_FACTOR_POWER 4
 
 static const char kCommonShaderSource[] =
@@ -323,7 +321,7 @@
     // If there was an error while resizing, just use the unscaled texture.
     GLenum error = s_gles2.glGetError();
     if (error != GL_NO_ERROR) {
-        V("GL error while resizing: 0x%x (ignored)\n", error);
+        VERBOSE("GL error while resizing: 0x%x (ignored)\n", error);
         return texture;
     }
 
@@ -468,7 +466,7 @@
     if (success == GL_FALSE) {
         GLchar infolog[256];
         s_gles2.glGetProgramInfoLog(mProgram, sizeof(infolog), 0, infolog);
-        fprintf(stderr, "Could not create/link program: %s\n", infolog);
+        ERR("Could not create/link program: %s\n", infolog);
         return;
     }
 
diff --git a/host/vulkan/VkDecoderGlobalState.h b/host/vulkan/VkDecoderGlobalState.h
index 6f6646b..23f20c4 100644
--- a/host/vulkan/VkDecoderGlobalState.h
+++ b/host/vulkan/VkDecoderGlobalState.h
@@ -103,13 +103,6 @@
                                                        uint32_t* pPropertyCount,
                                                        VkExtensionProperties* pProperties);
 
-    // Fast way to get dispatch tables associated with a Vulkan object.
-    // VkInstance
-    // VkPhysicalDevice
-    // VkDevice
-    // VkQueue
-    // VkCommandBuffer
-
     VkResult on_vkCreateInstance(android::base::BumpPool* pool, VkSnapshotApiCallInfo* snapshotInfo,
                                  const VkInstanceCreateInfo* pCreateInfo,
                                  const VkAllocationCallbacks* pAllocator, VkInstance* pInstance);