status_t BufferQueue::connect(int api, bool producerControlledByApp, QueueBufferOutput* output) {
ATRACE_CALL();
- ST_LOGV("connect: api=%d", api);
+ ST_LOGV("connect: api=%d producerControlledByApp=%s", api,
+ producerControlledByApp ? "true" : "false");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
status_t BufferQueue::consumerConnect(const sp<IConsumerListener>& consumerListener,
bool controlledByApp) {
- ST_LOGV("consumerConnect");
+ ST_LOGV("consumerConnect controlledByApp=%s",
+ controlledByApp ? "true" : "false");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
ifeq ($(BOARD_ALLOW_EGL_HIBERNATION),true)
LOCAL_CFLAGS += -DBOARD_ALLOW_EGL_HIBERNATION
endif
-
-ifeq ($(TARGET_BOARD_PLATFORM),msm7k)
- LOCAL_CFLAGS += -DADRENO130=1
-endif
-
-ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
- # see Loader.cpp for details
- LOCAL_CFLAGS += -DSYSTEMUI_PBSIZE_HACK=1
+ifeq ($(TARGET_BOARD_PLATFORM), omap4)
+ LOCAL_CFLAGS += -DWORKAROUND_BUG_10194508=1
endif
-
ifneq ($(MAX_EGL_CACHE_ENTRY_SIZE),)
LOCAL_CFLAGS += -DMAX_EGL_CACHE_ENTRY_SIZE=$(MAX_EGL_CACHE_ENTRY_SIZE)
endif
ALOGE_IF(!getProcAddress,
"can't find eglGetProcAddress() in %s", driver_absolute_path);
-#ifdef SYSTEMUI_PBSIZE_HACK
-#warning "SYSTEMUI_PBSIZE_HACK enabled"
- /*
- * TODO: replace SYSTEMUI_PBSIZE_HACK by something less hackish
- *
- * Here we adjust the PB size from its default value to 512KB which
- * is the minimum acceptable for the systemui process.
- * We do this on low-end devices only because it allows us to enable
- * h/w acceleration in the systemui process while keeping the
- * memory usage down.
- *
- * Obviously, this is the wrong place and wrong way to make this
- * adjustment, but at the time of this writing this was the safest
- * solution.
- */
- const char *cmdline = getProcessCmdline();
- if (strstr(cmdline, "systemui")) {
- void *imgegl = dlopen("/vendor/lib/libIMGegl.so", RTLD_LAZY);
- if (imgegl) {
- unsigned int *PVRDefaultPBS =
- (unsigned int *)dlsym(imgegl, "PVRDefaultPBS");
- if (PVRDefaultPBS) {
- ALOGD("setting default PBS to 512KB, was %d KB", *PVRDefaultPBS / 1024);
- *PVRDefaultPBS = 512*1024;
- }
- }
- }
-#endif
-
egl_t* egl = &cnx->egl;
__eglMustCastToProperFunctionPointerType* curr =
(__eglMustCastToProperFunctionPointerType*)egl;
// of our native format. So if sRGB gamma is requested, we have to
// modify the EGLconfig's format before setting the native window's
// format.
-
+#if WORKAROUND_BUG_10194508
+#warning "WORKAROUND_10194508 enabled"
+ EGLint format;
+ if (!cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_NATIVE_VISUAL_ID,
+ &format)) {
+ ALOGE("eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID) failed: %#x",
+ eglGetError());
+ format = 0;
+ }
+ if (attrib_list) {
+ for (const EGLint* attr = attrib_list; *attr != EGL_NONE;
+ attr += 2) {
+ if (*attr == EGL_GL_COLORSPACE_KHR &&
+ dp->haveExtension("EGL_KHR_gl_colorspace")) {
+ format = modifyFormatColorspace(format, *(attr+1));
+ }
+ }
+ }
+#else
// by default, just pick RGBA_8888
EGLint format = HAL_PIXEL_FORMAT_RGBA_8888;
}
}
}
+#endif
if (format != 0) {
int err = native_window_set_buffers_format(window, format);
if (err != 0) {
cnx->major = -1;
cnx->minor = -1;
if (cnx->dso) {
-
-#if defined(ADRENO130)
-#warning "Adreno-130 eglInitialize() workaround"
- /*
- * The ADRENO 130 driver returns a different EGLDisplay each time
- * eglGetDisplay() is called, but also makes the EGLDisplay invalid
- * after eglTerminate() has been called, so that eglInitialize()
- * cannot be called again. Therefore, we need to make sure to call
- * eglGetDisplay() before calling eglInitialize();
- */
- if (i == IMPL_HARDWARE) {
- disp[i].dpy = cnx->egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
- }
-#endif
-
EGLDisplay idpy = disp.dpy;
if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) {
//ALOGD("initialized dpy=%p, ver=%d.%d, cnx=%p",
if (result == EGL_TRUE) {
if (mType >= DisplayDevice::DISPLAY_VIRTUAL)
eglSwapInterval(dpy, 0);
- setViewportAndProjection();
}
}
+ setViewportAndProjection();
return result;
}
sp<Fence> outFence = mHwc.getLastRetireFence(mDisplayId);
VDS_LOGV("onFrameCommitted: queue sink sslot=%d", sslot);
status_t result = mSource[SOURCE_SINK]->queueBuffer(sslot,
- QueueBufferInput(systemTime(), false,
+ QueueBufferInput(
+ systemTime(), false /* isAutoTimestamp */,
Rect(mSinkBufferWidth, mSinkBufferHeight),
- NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, outFence),
+ NATIVE_WINDOW_SCALING_MODE_FREEZE, 0 /* transform */,
+ true /* async*/,
+ outFence),
&qbo);
if (result == NO_ERROR) {
updateQueueBufferOutput(qbo);
}
status_t VirtualDisplaySurface::dequeueBuffer(Source source,
- uint32_t format, int* sslot, sp<Fence>* fence, bool async) {
+ uint32_t format, int* sslot, sp<Fence>* fence) {
+ // Don't let a slow consumer block us
+ bool async = (source == SOURCE_SINK);
+
status_t result = mSource[source]->dequeueBuffer(sslot, fence, async,
mSinkBufferWidth, mSinkBufferHeight, format, mProducerUsage);
if (result < 0)
"Unexpected dequeueBuffer() in %s state", dbgStateStr());
mDbgState = DBG_STATE_GLES;
+ VDS_LOGW_IF(!async, "EGL called dequeueBuffer with !async despite eglSwapInterval(0)");
VDS_LOGV("dequeueBuffer %dx%d fmt=%d usage=%#x", w, h, format, usage);
status_t result = NO_ERROR;
*fence = mOutputFence;
} else {
int sslot;
- result = dequeueBuffer(source, format, &sslot, fence, async);
+ result = dequeueBuffer(source, format, &sslot, fence);
if (result >= 0) {
*pslot = mapSource2ProducerSlot(source, sslot);
}
}
int sslot;
- status_t result = dequeueBuffer(SOURCE_SINK, 0, &sslot, &mOutputFence, false);
+ status_t result = dequeueBuffer(SOURCE_SINK, 0, &sslot, &mOutputFence);
if (result < 0)
return result;
mOutputProducerSlot = mapSource2ProducerSlot(SOURCE_SINK, sslot);
//
static Source fbSourceForCompositionType(CompositionType type);
status_t dequeueBuffer(Source source, uint32_t format,
- int* sslot, sp<Fence>* fence, bool async);
+ int* sslot, sp<Fence>* fence);
void updateQueueBufferOutput(const QueueBufferOutput& qbo);
void resetPerFrameState();
status_t refreshOutputBuffer();
void Layer::clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip,
float red, float green, float blue, float alpha) const
{
+ RenderEngine& engine(mFlinger->getRenderEngine());
computeGeometry(hw, mMesh);
- mFlinger->getRenderEngine().fillWithColor(mMesh, red, green, blue, alpha);
+ engine.setupFillWithColor(red, green, blue, alpha);
+ engine.drawMesh(mMesh);
}
void Layer::clearWithOpenGL(
glDeleteTextures(1, &texName);
}
-void GLES11RenderEngine::fillWithColor(const Mesh& mesh, float r, float g, float b, float a) {
+void GLES11RenderEngine::setupFillWithColor(float r, float g, float b, float a) {
glColor4f(r, g, b, a);
glDisable(GL_TEXTURE_EXTERNAL_OES);
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
-
- glVertexPointer(mesh.getVertexSize(),
- GL_FLOAT,
- mesh.getByteStride(),
- mesh.getPositions());
-
- glDrawArrays(mesh.getPrimitive(), 0, mesh.getVertexCount());
}
void GLES11RenderEngine::drawMesh(const Mesh& mesh) {
virtual void setupDimLayerBlending(int alpha);
virtual void setupLayerTexturing(const Texture& texture);
virtual void setupLayerBlackedOut();
+ virtual void setupFillWithColor(float r, float g, float b, float a) ;
virtual void disableTexturing();
virtual void disableBlending();
- virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a) ;
virtual void drawMesh(const Mesh& mesh);
virtual size_t getMaxTextureSize() const;
glDeleteTextures(1, &texName);
}
-void GLES20RenderEngine::fillWithColor(const Mesh& mesh, float r, float g, float b, float a) {
+void GLES20RenderEngine::setupFillWithColor(float r, float g, float b, float a) {
+ mState.setPlaneAlpha(1.0f);
+ mState.setPremultipliedAlpha(true);
+ mState.setOpaque(false);
mState.setColor(r, g, b, a);
- disableTexturing();
+ mState.disableTexture();
glDisable(GL_BLEND);
-
- ProgramCache::getInstance().useProgram(mState);
-
- glVertexAttribPointer(Program::position,
- mesh.getVertexSize(),
- GL_FLOAT, GL_FALSE,
- mesh.getByteStride(),
- mesh.getPositions());
-
- glDrawArrays(mesh.getPrimitive(), 0, mesh.getVertexCount());
}
void GLES20RenderEngine::drawMesh(const Mesh& mesh) {
virtual void setupDimLayerBlending(int alpha);
virtual void setupLayerTexturing(const Texture& texture);
virtual void setupLayerBlackedOut();
+ virtual void setupFillWithColor(float r, float g, float b, float a);
virtual void disableTexturing();
virtual void disableBlending();
- virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a);
virtual void drawMesh(const Mesh& mesh);
virtual size_t getMaxTextureSize() const;
position[i*6 + 5].x = r->right;
position[i*6 + 5].y = height - r->top;
}
- fillWithColor(mesh, red, green, blue, alpha);
+ setupFillWithColor(red, green, blue, alpha);
+ drawMesh(mesh);
}
void RenderEngine::clearWithColor(float red, float green, float blue, float alpha) {
virtual void setupDimLayerBlending(int alpha) = 0;
virtual void setupLayerTexturing(const Texture& texture) = 0;
virtual void setupLayerBlackedOut() = 0;
+ virtual void setupFillWithColor(float r, float g, float b, float a) = 0;
virtual void disableTexturing() = 0;
virtual void disableBlending() = 0;
// drawing
- virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a) = 0;
virtual void drawMesh(const Mesh& mesh) = 0;
// queries
// compositionComplete is needed for older driver
hw->compositionComplete();
+ hw->setViewportAndProjection();
}
native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL);
}
- hw->setViewportAndProjection();
-
return result;
}