Set up a RenderState for the host version of RenderThread

CanvasContext expects the render thread to have a non-null render state
associated with it. This adds a render state to the host render thread.

Bug: 322360037
Test: build libhwui on host
Change-Id: Ied07d4bc86eec21ddbb1bfb6cfd45418c70edce0
diff --git a/libs/hwui/Android.bp b/libs/hwui/Android.bp
index 29bb1b9..4706699 100644
--- a/libs/hwui/Android.bp
+++ b/libs/hwui/Android.bp
@@ -538,6 +538,7 @@
         "pipeline/skia/RenderNodeDrawable.cpp",
         "pipeline/skia/ReorderBarrierDrawables.cpp",
         "pipeline/skia/TransformCanvas.cpp",
+        "renderstate/RenderState.cpp",
         "renderthread/Frame.cpp",
         "renderthread/RenderTask.cpp",
         "renderthread/TimeLord.cpp",
@@ -615,7 +616,6 @@
                 "pipeline/skia/SkiaVulkanPipeline.cpp",
                 "pipeline/skia/VkFunctorDrawable.cpp",
                 "pipeline/skia/VkInteropFunctorDrawable.cpp",
-                "renderstate/RenderState.cpp",
                 "renderthread/CacheManager.cpp",
                 "renderthread/CanvasContext.cpp",
                 "renderthread/DrawFrameTask.cpp",
diff --git a/libs/hwui/platform/host/renderthread/RenderThread.cpp b/libs/hwui/platform/host/renderthread/RenderThread.cpp
index 6f08b59..f9d0f47 100644
--- a/libs/hwui/platform/host/renderthread/RenderThread.cpp
+++ b/libs/hwui/platform/host/renderthread/RenderThread.cpp
@@ -17,6 +17,7 @@
 #include "renderthread/RenderThread.h"
 
 #include "Readback.h"
+#include "renderstate/RenderState.h"
 #include "renderthread/VulkanManager.h"
 
 namespace android {
@@ -66,6 +67,7 @@
 RenderThread::~RenderThread() {}
 
 void RenderThread::initThreadLocals() {
+    mRenderState = new RenderState(*this);
     mCacheManager = new CacheManager(*this);
 }
 
diff --git a/libs/hwui/renderstate/RenderState.h b/libs/hwui/renderstate/RenderState.h
index e08d32a..60657cf 100644
--- a/libs/hwui/renderstate/RenderState.h
+++ b/libs/hwui/renderstate/RenderState.h
@@ -16,11 +16,13 @@
 #ifndef RENDERSTATE_H
 #define RENDERSTATE_H
 
-#include "utils/Macros.h"
-
+#include <pthread.h>
 #include <utils/RefBase.h>
+
 #include <set>
 
+#include "utils/Macros.h"
+
 namespace android {
 namespace uirenderer {