Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 417d8925 authored by Giulio Cervera's avatar Giulio Cervera
Browse files

Revert "Select texture target based on pixel format"

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
parent 5e30781a
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -141,12 +141,7 @@ public:
    //
    // 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
@@ -511,11 +506,7 @@ private:
    // 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.
+0 −15
Original line number Diff line number Diff line
@@ -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);

@@ -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.
+0 −33
Original line number Diff line number Diff line
@@ -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
@@ -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;