Set correct glViewPort when composing secondary displays
Bug: 185631250
Test: verify secondary display shows correctly with minigbm and virtio
gpu mode
Change-Id: I6bf9837b7660e4eb60ec029ccd4de3d75e6fc496
diff --git a/stream-servers/PostWorker.cpp b/stream-servers/PostWorker.cpp
index 8f3f374..9fffb57 100644
--- a/stream-servers/PostWorker.cpp
+++ b/stream-servers/PostWorker.cpp
@@ -231,7 +231,7 @@
l->displayFrame.right, l->displayFrame.bottom,
l->crop.left, l->crop.top, l->crop.right,
l->crop.bottom);
- composeLayer(l);
+ composeLayer(l, mFb->getWidth(), mFb->getHeight());
}
cbPtr->setSync();
@@ -249,7 +249,16 @@
ComposeLayer* l = (ComposeLayer*)p->layer;
GLint vport[4] = { 0, };
s_gles2.glGetIntegerv(GL_VIEWPORT, vport);
- s_gles2.glViewport(0, 0, mFb->getWidth(),mFb->getHeight());
+ uint32_t w, h;
+ emugl::get_emugl_multi_display_operations().getMultiDisplay(p->displayId,
+ nullptr,
+ nullptr,
+ &w,
+ &h,
+ nullptr,
+ nullptr,
+ nullptr);
+ s_gles2.glViewport(0, 0, w, h);
if (!m_composeFbo) {
s_gles2.glGenFramebuffers(1, &m_composeFbo);
}
@@ -281,7 +290,7 @@
l->displayFrame.right, l->displayFrame.bottom,
l->crop.left, l->crop.top, l->crop.right,
l->crop.bottom);
- composeLayer(l);
+ composeLayer(l, w, h);
}
cbPtr->setSync();
@@ -310,7 +319,7 @@
}
}
-void PostWorker::composeLayer(ComposeLayer* l) {
+void PostWorker::composeLayer(ComposeLayer* l, uint32_t w, uint32_t h) {
if (l->composeMode == HWC2_COMPOSITION_DEVICE) {
ColorBufferPtr cb = mFb->findColorBuffer(l->cbHandle);
if (!cb) {
@@ -318,12 +327,11 @@
// ERR("%s: fail to find colorbuffer %d\n", __FUNCTION__, l->cbHandle);
return;
}
- cb->postLayer(l, mFb->getWidth(), mFb->getHeight());
+ cb->postLayer(l, w, h);
}
else {
// no Colorbuffer associated with SOLID_COLOR mode
- mFb->getTextureDraw()->drawLayer(l, mFb->getWidth(), mFb->getHeight(),
- 1, 1, 0);
+ mFb->getTextureDraw()->drawLayer(l, w, h, 1, 1, 0);
}
}
diff --git a/stream-servers/PostWorker.h b/stream-servers/PostWorker.h
index 9e7ccd5..3182085 100644
--- a/stream-servers/PostWorker.h
+++ b/stream-servers/PostWorker.h
@@ -84,7 +84,7 @@
void bind();
void unbind();
- void composeLayer(ComposeLayer* l);
+ void composeLayer(ComposeLayer* l, uint32_t w, uint32_t h);
void fillMultiDisplayPostStruct(ComposeLayer* l,
hwc_rect_t displayArea,
hwc_frect_t cropArea,