Loading libs/surfaceflinger/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_C_INCLUDES := \ $(call include-path-for, corecg graphics) LOCAL_C_INCLUDES += hardware/libhardware/modules/gralloc LOCAL_MODULE:= libsurfaceflinger include $(BUILD_SHARED_LIBRARY) libs/surfaceflinger/LayerBuffer.cpp +44 −42 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include "SurfaceFlinger.h" #include "DisplayHardware/DisplayHardware.h" #include "gralloc_priv.h" // needed for msm / copybit namespace android { Loading Loading @@ -233,20 +234,28 @@ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) : mBufferHeap(buffers) { NativeBuffer& src(mNativeBuffer); src.crop.l = 0; src.crop.t = 0; src.crop.r = buffers.w; src.crop.b = buffers.h; src.img.w = buffers.hor_stride ?: buffers.w; src.img.h = buffers.ver_stride ?: buffers.h; src.img.format = buffers.format; src.img.offset = offset; src.img.base = buffers.heap->base(); src.img.fd = buffers.heap->heapID(); src.img.base = (void*)(intptr_t(buffers.heap->base()) + offset); private_handle_t* hnd = new private_handle_t( buffers.heap->heapID(), buffers.heap->getSize(), 0); hnd->offset = offset; src.img.handle = hnd; } LayerBuffer::Buffer::~Buffer() { NativeBuffer& src(mNativeBuffer); if (src.img.handle) delete (private_handle_t*)src.img.handle; } // ============================================================================ Loading Loading @@ -465,17 +474,11 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const android_native_buffer_t const* nb = fbw->getBackbuffer(); native_handle_t const* hnd = nb->handle; if (hnd->data[1] != 0x3141592) { LOGE("buffer not compatible with copybit"); err = -1; } else { dst.w = 320; dst.h = 480; dst.format = 4; dst.offset = hnd->data[4]; dst.base = 0; dst.fd = hnd->data[0]; dst.handle = (native_handle_t *)nb->handle; const Rect& transformedBounds = mLayer.getTransformedBounds(); const copybit_rect_t& drect Loading Loading @@ -505,7 +508,6 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const LOGE("copybit failed (%s)", strerror(err)); } } } if (!copybit || err) { Loading @@ -522,7 +524,7 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const t.stride = src.img.w; t.vstride= src.img.h; t.format = src.img.format; t.data = (GGLubyte*)(intptr_t(src.img.base) + src.img.offset); t.data = (GGLubyte*)src.img.base; const Region dirty(Rect(t.width, t.height)); mLayer.loadTexture(&mTexture, mTexture.name, dirty, t); mTexture.transform = mBufferHeap.transform; Loading opengl/libagl/copybit.cpp +1 −6 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ #include <hardware/gralloc.h> #include <hardware/copybit.h> #include <private/ui/android_natives_priv.h> #include "gralloc_priv.h" #define DEBUG_COPYBIT true Loading @@ -44,14 +43,11 @@ namespace android { static void textureToCopyBitImage( const GGLSurface* surface, buffer_handle_t buffer, copybit_image_t* img) { // we know private_handle_t is good here private_handle_t* hnd = (private_handle_t*)buffer; img->w = surface->stride; img->h = surface->height; img->format = surface->format; img->offset = hnd->offset; img->base = surface->data; img->fd = hnd->fd; img->handle = (native_handle_t *)buffer; } struct clipRectRegion : public copybit_region_t { Loading Loading @@ -283,7 +279,6 @@ static bool copybit(GLint x, GLint y, textureToCopyBitImage(&cbSurface, target_hnd, &dst); copybit_rect_t drect = {x, y, x+w, y+h}; // we know private_handle_t is good here copybit_image_t src; buffer_handle_t source_hnd = textureObject->buffer->handle; textureToCopyBitImage(&textureObject->surface, source_hnd, &src); Loading Loading
libs/surfaceflinger/Android.mk +2 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_C_INCLUDES := \ $(call include-path-for, corecg graphics) LOCAL_C_INCLUDES += hardware/libhardware/modules/gralloc LOCAL_MODULE:= libsurfaceflinger include $(BUILD_SHARED_LIBRARY)
libs/surfaceflinger/LayerBuffer.cpp +44 −42 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ #include "SurfaceFlinger.h" #include "DisplayHardware/DisplayHardware.h" #include "gralloc_priv.h" // needed for msm / copybit namespace android { Loading Loading @@ -233,20 +234,28 @@ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) : mBufferHeap(buffers) { NativeBuffer& src(mNativeBuffer); src.crop.l = 0; src.crop.t = 0; src.crop.r = buffers.w; src.crop.b = buffers.h; src.img.w = buffers.hor_stride ?: buffers.w; src.img.h = buffers.ver_stride ?: buffers.h; src.img.format = buffers.format; src.img.offset = offset; src.img.base = buffers.heap->base(); src.img.fd = buffers.heap->heapID(); src.img.base = (void*)(intptr_t(buffers.heap->base()) + offset); private_handle_t* hnd = new private_handle_t( buffers.heap->heapID(), buffers.heap->getSize(), 0); hnd->offset = offset; src.img.handle = hnd; } LayerBuffer::Buffer::~Buffer() { NativeBuffer& src(mNativeBuffer); if (src.img.handle) delete (private_handle_t*)src.img.handle; } // ============================================================================ Loading Loading @@ -465,17 +474,11 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const android_native_buffer_t const* nb = fbw->getBackbuffer(); native_handle_t const* hnd = nb->handle; if (hnd->data[1] != 0x3141592) { LOGE("buffer not compatible with copybit"); err = -1; } else { dst.w = 320; dst.h = 480; dst.format = 4; dst.offset = hnd->data[4]; dst.base = 0; dst.fd = hnd->data[0]; dst.handle = (native_handle_t *)nb->handle; const Rect& transformedBounds = mLayer.getTransformedBounds(); const copybit_rect_t& drect Loading Loading @@ -505,7 +508,6 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const LOGE("copybit failed (%s)", strerror(err)); } } } if (!copybit || err) { Loading @@ -522,7 +524,7 @@ void LayerBuffer::BufferSource::onDraw(const Region& clip) const t.stride = src.img.w; t.vstride= src.img.h; t.format = src.img.format; t.data = (GGLubyte*)(intptr_t(src.img.base) + src.img.offset); t.data = (GGLubyte*)src.img.base; const Region dirty(Rect(t.width, t.height)); mLayer.loadTexture(&mTexture, mTexture.name, dirty, t); mTexture.transform = mBufferHeap.transform; Loading
opengl/libagl/copybit.cpp +1 −6 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ #include <hardware/gralloc.h> #include <hardware/copybit.h> #include <private/ui/android_natives_priv.h> #include "gralloc_priv.h" #define DEBUG_COPYBIT true Loading @@ -44,14 +43,11 @@ namespace android { static void textureToCopyBitImage( const GGLSurface* surface, buffer_handle_t buffer, copybit_image_t* img) { // we know private_handle_t is good here private_handle_t* hnd = (private_handle_t*)buffer; img->w = surface->stride; img->h = surface->height; img->format = surface->format; img->offset = hnd->offset; img->base = surface->data; img->fd = hnd->fd; img->handle = (native_handle_t *)buffer; } struct clipRectRegion : public copybit_region_t { Loading Loading @@ -283,7 +279,6 @@ static bool copybit(GLint x, GLint y, textureToCopyBitImage(&cbSurface, target_hnd, &dst); copybit_rect_t drect = {x, y, x+w, y+h}; // we know private_handle_t is good here copybit_image_t src; buffer_handle_t source_hnd = textureObject->buffer->handle; textureToCopyBitImage(&textureObject->surface, source_hnd, &src); Loading