Loading libs/surfaceflinger/Android.mk +0 −4 Original line number Diff line number Diff line Loading @@ -20,10 +20,6 @@ LOCAL_SRC_FILES:= \ LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\" LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES ifeq ($(TARGET_BOARD_PLATFORM), msm7k) LOCAL_CFLAGS += -DDIM_WITH_TEXTURE endif # need "-lrt" on Linux simulator to pick up clock_gettime ifeq ($(TARGET_SIMULATOR),true) ifeq ($(HOST_OS),linux) Loading libs/surfaceflinger/LayerDim.cpp +1 −68 Original line number Diff line number Diff line Loading @@ -51,54 +51,6 @@ void LayerDim::initDimmer(SurfaceFlinger* flinger, uint32_t w, uint32_t h) sWidth = w; sHeight = h; sUseTexture = false; #if defined(DIM_WITH_TEXTURE) && defined(EGL_ANDROID_image_native_buffer) #warning "using a texture to implement LayerDim" /* On some h/w like msm7K, it is faster to use a texture because the * software renderer will defer to copybit, for this to work we need to * use an EGLImage texture so copybit can actually make use of it. * This burns a full-screen worth of graphic memory. */ const DisplayHardware& hw(flinger->graphicPlane(0).displayHardware()); uint32_t flags = hw.getFlags(); if (LIKELY(flags & DisplayHardware::DIRECT_TEXTURE)) { sp<GraphicBuffer> buffer = new GraphicBuffer(w, h, PIXEL_FORMAT_RGB_565, GraphicBuffer::USAGE_SW_WRITE_OFTEN | GraphicBuffer::USAGE_HW_TEXTURE); android_native_buffer_t* clientBuf = buffer->getNativeBuffer(); glGenTextures(1, &sTexId); glBindTexture(GL_TEXTURE_2D, sTexId); EGLDisplay dpy = eglGetCurrentDisplay(); sImage = eglCreateImageKHR(dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, (EGLClientBuffer)clientBuf, 0); if (sImage == EGL_NO_IMAGE_KHR) { LOGE("eglCreateImageKHR() failed. err=0x%4x", eglGetError()); return; } glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)sImage); GLint error = glGetError(); if (error != GL_NO_ERROR) { eglDestroyImageKHR(dpy, sImage); LOGE("glEGLImageTargetTexture2DOES() failed. err=0x%4x", error); return; } // initialize the texture with zeros GGLSurface t; buffer->lock(&t, GRALLOC_USAGE_SW_WRITE_OFTEN); memset(t.data, 0, t.stride * t.height * 2); buffer->unlock(); sUseTexture = true; } #endif } LayerDim::~LayerDim() Loading @@ -124,26 +76,7 @@ void LayerDim::onDraw(const Region& clip) const glDisable(GL_TEXTURE_EXTERNAL_OES); } #endif #if defined(DIM_WITH_TEXTURE) && defined(EGL_ANDROID_image_native_buffer) if (sUseTexture) { glBindTexture(GL_TEXTURE_2D, sTexId); glEnable(GL_TEXTURE_2D); glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); const GLshort texCoords[4][2] = { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 1, 0 } }; glMatrixMode(GL_TEXTURE); glLoadIdentity(); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_SHORT, 0, texCoords); } else #endif { glDisable(GL_TEXTURE_2D); } GLshort w = sWidth; GLshort h = sHeight; Loading Loading
libs/surfaceflinger/Android.mk +0 −4 Original line number Diff line number Diff line Loading @@ -20,10 +20,6 @@ LOCAL_SRC_FILES:= \ LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\" LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES ifeq ($(TARGET_BOARD_PLATFORM), msm7k) LOCAL_CFLAGS += -DDIM_WITH_TEXTURE endif # need "-lrt" on Linux simulator to pick up clock_gettime ifeq ($(TARGET_SIMULATOR),true) ifeq ($(HOST_OS),linux) Loading
libs/surfaceflinger/LayerDim.cpp +1 −68 Original line number Diff line number Diff line Loading @@ -51,54 +51,6 @@ void LayerDim::initDimmer(SurfaceFlinger* flinger, uint32_t w, uint32_t h) sWidth = w; sHeight = h; sUseTexture = false; #if defined(DIM_WITH_TEXTURE) && defined(EGL_ANDROID_image_native_buffer) #warning "using a texture to implement LayerDim" /* On some h/w like msm7K, it is faster to use a texture because the * software renderer will defer to copybit, for this to work we need to * use an EGLImage texture so copybit can actually make use of it. * This burns a full-screen worth of graphic memory. */ const DisplayHardware& hw(flinger->graphicPlane(0).displayHardware()); uint32_t flags = hw.getFlags(); if (LIKELY(flags & DisplayHardware::DIRECT_TEXTURE)) { sp<GraphicBuffer> buffer = new GraphicBuffer(w, h, PIXEL_FORMAT_RGB_565, GraphicBuffer::USAGE_SW_WRITE_OFTEN | GraphicBuffer::USAGE_HW_TEXTURE); android_native_buffer_t* clientBuf = buffer->getNativeBuffer(); glGenTextures(1, &sTexId); glBindTexture(GL_TEXTURE_2D, sTexId); EGLDisplay dpy = eglGetCurrentDisplay(); sImage = eglCreateImageKHR(dpy, EGL_NO_CONTEXT, EGL_NATIVE_BUFFER_ANDROID, (EGLClientBuffer)clientBuf, 0); if (sImage == EGL_NO_IMAGE_KHR) { LOGE("eglCreateImageKHR() failed. err=0x%4x", eglGetError()); return; } glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)sImage); GLint error = glGetError(); if (error != GL_NO_ERROR) { eglDestroyImageKHR(dpy, sImage); LOGE("glEGLImageTargetTexture2DOES() failed. err=0x%4x", error); return; } // initialize the texture with zeros GGLSurface t; buffer->lock(&t, GRALLOC_USAGE_SW_WRITE_OFTEN); memset(t.data, 0, t.stride * t.height * 2); buffer->unlock(); sUseTexture = true; } #endif } LayerDim::~LayerDim() Loading @@ -124,26 +76,7 @@ void LayerDim::onDraw(const Region& clip) const glDisable(GL_TEXTURE_EXTERNAL_OES); } #endif #if defined(DIM_WITH_TEXTURE) && defined(EGL_ANDROID_image_native_buffer) if (sUseTexture) { glBindTexture(GL_TEXTURE_2D, sTexId); glEnable(GL_TEXTURE_2D); glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); const GLshort texCoords[4][2] = { { 0, 0 }, { 0, 1 }, { 1, 1 }, { 1, 0 } }; glMatrixMode(GL_TEXTURE); glLoadIdentity(); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTexCoordPointer(2, GL_SHORT, 0, texCoords); } else #endif { glDisable(GL_TEXTURE_2D); } GLshort w = sWidth; GLshort h = sHeight; Loading