A better HW Bitmap uploader

Move all HW bitmap upload operations off of RenderThread.
Ensure EGL context outlives all upload requests

Bug: 79250950
Test: builds, boots, systrace is good, CTS bitmap tests pass

Change-Id: I5ace6c516d33b1afdf1a407cd8b183f6b60c22c1
diff --git a/libs/hwui/renderthread/EglManager.h b/libs/hwui/renderthread/EglManager.h
index ca6d1b8..8e8bb8b 100644
--- a/libs/hwui/renderthread/EglManager.h
+++ b/libs/hwui/renderthread/EglManager.h
@@ -64,6 +64,8 @@
 
     void fence();
 
+    EGLDisplay eglDisplay() const { return mEglDisplay; }
+
 private:
 
     void initExtensions();
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 4d1e1e8..02d0b6d 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -319,17 +319,6 @@
     }
 }
 
-sk_sp<Bitmap> RenderProxy::allocateHardwareBitmap(SkBitmap& bitmap) {
-    auto& thread = RenderThread::getInstance();
-    if (Properties::getRenderPipelineType() == RenderPipelineType::SkiaGL) {
-        return skiapipeline::SkiaOpenGLPipeline::allocateHardwareBitmap(thread, bitmap);
-    } else {
-        return thread.queue().runSync([&]() -> auto {
-            return thread.allocateHardwareBitmap(bitmap);
-        });
-    }
-}
-
 int RenderProxy::copyGraphicBufferInto(GraphicBuffer* buffer, SkBitmap* bitmap) {
     RenderThread& thread = RenderThread::getInstance();
     if (gettid() == thread.getTid()) {
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
index 433adeb..9e46161 100644
--- a/libs/hwui/renderthread/RenderProxy.h
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -123,8 +123,6 @@
                                            int bottom, SkBitmap* bitmap);
     ANDROID_API static void prepareToDraw(Bitmap& bitmap);
 
-    static sk_sp<Bitmap> allocateHardwareBitmap(SkBitmap& bitmap);
-
     static int copyGraphicBufferInto(GraphicBuffer* buffer, SkBitmap* bitmap);
 
     static void onBitmapDestroyed(uint32_t pixelRefId);