Skip to content

Commit

Permalink
Revert "Select texture target based on pixel format"
Browse files Browse the repository at this point in the history
Automatic revert was not possible.

Graphics team completed the optimizations for GL_TEXTURE_EXTERNAL,
and this change is no longer required in frameworks.

Change-Id: I8330d19e686b450d3fb6ca2d96c0615f16c0906b
CRs-fixed: 328074, 345078, 344565
  • Loading branch information
Kali- committed Apr 24, 2012
1 parent 5e30781 commit 417d892
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 57 deletions.
9 changes: 0 additions & 9 deletions include/gui/SurfaceTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,7 @@ class SurfaceTexture : public BnSurfaceTexture {
//
// This call may only be made while the OpenGL ES context to which the
// target texture belongs is bound to the calling thread.
#ifndef QCOM_HARDWARE
status_t updateTexImage();
#else
//
status_t updateTexImage(bool isComposition = false);
#endif

// setBufferCountServer set the buffer count. If the client has requested
// a buffer count using setBufferCount, the server-buffer count will
Expand Down Expand Up @@ -511,11 +506,7 @@ class SurfaceTexture : public BnSurfaceTexture {
// glCopyTexSubImage to read from the texture. This is a hack to work
// around a GL driver limitation on the number of FBO attachments, which the
// browser's tile cache exceeds.
#ifdef QCOM_HARDWARE
GLenum mTexTarget;
#else
const GLenum mTexTarget;
#endif

// mFrameCounter is the free running counter, incremented for every buffer queued
// with the surface Texture.
Expand Down
15 changes: 0 additions & 15 deletions libs/gui/SurfaceTexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,11 +842,7 @@ status_t SurfaceTexture::setScalingMode(int mode) {
return OK;
}

#ifdef QCOM_HARDWARE
status_t SurfaceTexture::updateTexImage(bool isComposition) {
#else
status_t SurfaceTexture::updateTexImage() {
#endif
ST_LOGV("updateTexImage");
Mutex::Autolock lock(mMutex);

Expand Down Expand Up @@ -876,17 +872,6 @@ status_t SurfaceTexture::updateTexImage() {
mSlots[buf].mEglImage = image;
mSlots[buf].mEglDisplay = dpy;

#ifdef QCOM_HARDWARE
// GPU is not efficient in handling GL_TEXTURE_EXTERNAL_OES
// texture target. Depending on the image format, decide,
// the texture target to be used

if (isComposition) {
mTexTarget =
decideTextureTarget (mSlots[buf].mGraphicBuffer->format);
}
#endif

if (image == EGL_NO_IMAGE_KHR) {
// NOTE: if dpy was invalid, createImage() is guaranteed to
// fail. so we'd end up here.
Expand Down
33 changes: 0 additions & 33 deletions services/surfaceflinger/Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,52 +316,29 @@ void Layer::onDraw(const Region& clip) const
clearWithOpenGL(clip, 0, 0, 0, 1);
return;
}

GLuint currentTextureTarget = mSurfaceTexture->getCurrentTextureTarget();
#endif

if (!isProtected()) {
#ifdef QCOM_HARDWARE
glBindTexture(currentTextureTarget, mTextureName);
#else
glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureName);
#endif
GLenum filter = GL_NEAREST;
if (getFiltering() || needsFiltering() || isFixedSize() || isCropped()) {
// TODO: we could be more subtle with isFixedSize()
filter = GL_LINEAR;
}
#ifdef QCOM_HARDWARE
glTexParameterx(currentTextureTarget, GL_TEXTURE_MAG_FILTER, filter);
glTexParameterx(currentTextureTarget, GL_TEXTURE_MIN_FILTER, filter);
#else
glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, filter);
glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, filter);
#endif
glMatrixMode(GL_TEXTURE);
glLoadMatrixf(mTextureMatrix);
glMatrixMode(GL_MODELVIEW);
glDisable(GL_TEXTURE_2D);
#ifdef QCOM_HARDWARE
glEnable(currentTextureTarget);
#else
glEnable(GL_TEXTURE_EXTERNAL_OES);
#endif
} else {
#ifdef QCOM_HARDWARE
glBindTexture(currentTextureTarget, mFlinger->getProtectedTexName());
#else
glBindTexture(GL_TEXTURE_2D, mFlinger->getProtectedTexName());
#endif
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
#ifdef QCOM_HARDWARE
glEnable(currentTextureTarget);
#else
glDisable(GL_TEXTURE_EXTERNAL_OES);
glEnable(GL_TEXTURE_2D);
#endif
}

#ifdef QCOM_HARDWARE
Expand Down Expand Up @@ -484,17 +461,7 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
mFlinger->signalEvent();
}

#ifdef QCOM_HARDWARE
// While calling updateTexImage() from SurfaceFlinger, let it know
// by passing an extra parameter
// This will be true always.

bool isComposition = true;

if (mSurfaceTexture->updateTexImage(isComposition) < NO_ERROR) {
#else
if (mSurfaceTexture->updateTexImage() < NO_ERROR) {
#endif
// something happened!
recomputeVisibleRegions = true;
return;
Expand Down

0 comments on commit 417d892

Please sign in to comment.