summaryrefslogtreecommitdiff
path: root/opengl/libagl/copybit.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2009-11-02 17:48:33 -0800
committer Mathias Agopian <mathias@google.com> 2009-11-02 17:48:33 -0800
commit36d0184e089831b74de6005f01da9e7b26679bb9 (patch)
tree8a6cb7b2f9e5c53db29bc818a403b26add0c66fe /opengl/libagl/copybit.cpp
parent989b76aadd92538c7ab4ca00c34508b42fda8cef (diff)
fix[2228133] pixelflinger ignores the "vertical stride" leading to artifacts when playing back video
we lost the concept of vertical stride when moving video playback to EGLImage. Here we bring it back in a somewhat hacky-way that will work only for the softgl/mdp backend.
Diffstat (limited to 'opengl/libagl/copybit.cpp')
-rw-r--r--opengl/libagl/copybit.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/opengl/libagl/copybit.cpp b/opengl/libagl/copybit.cpp
index 3de5b2ba5547..1bef859b2eba 100644
--- a/opengl/libagl/copybit.cpp
+++ b/opengl/libagl/copybit.cpp
@@ -46,13 +46,24 @@ namespace android {
static void textureToCopyBitImage(
const GGLSurface* surface, int32_t opFormat,
- buffer_handle_t buffer, copybit_image_t* img)
+ android_native_buffer_t* buffer, copybit_image_t* img)
{
+ uint32_t vstride = 0;
+ if (opFormat == COPYBIT_FORMAT_YCbCr_422_SP ||
+ opFormat == COPYBIT_FORMAT_YCbCr_420_SP) {
+ // NOTE: this static_cast is really not safe b/c we can't know for
+ // sure the buffer passed is of the right type.
+ // However, since we do this only for YUV formats, we should be safe
+ // since only SurfaceFlinger makes use of them.
+ GraphicBuffer* graphicBuffer = static_cast<GraphicBuffer*>(buffer);
+ vstride = graphicBuffer->getVerticalStride();
+ }
+
img->w = surface->stride;
- img->h = surface->height;
+ img->h = vstride ? vstride : surface->height;
img->format = opFormat;
img->base = surface->data;
- img->handle = (native_handle_t *)buffer;
+ img->handle = (native_handle_t *)buffer->handle;
}
struct clipRectRegion : public copybit_region_t {
@@ -279,8 +290,8 @@ static bool copybit(GLint x, GLint y,
copybit_device_t* copybit = c->copybits.blitEngine;
copybit_image_t src;
- buffer_handle_t source_hnd = textureObject->buffer->handle;
- textureToCopyBitImage(&textureObject->surface, opFormat, source_hnd, &src);
+ textureToCopyBitImage(&textureObject->surface, opFormat,
+ textureObject->buffer, &src);
copybit_rect_t srect = { Ucr, Vcr + Hcr, Ucr + Wcr, Vcr };
/*
@@ -360,8 +371,8 @@ static bool copybit(GLint x, GLint y,
}
copybit_image_t dst;
- buffer_handle_t target_hnd = c->copybits.drawSurfaceBuffer;
- textureToCopyBitImage(&cbSurface, cbSurface.format, target_hnd, &dst);
+ textureToCopyBitImage(&cbSurface, cbSurface.format,
+ c->copybits.drawSurfaceBuffer, &dst);
copybit_rect_t drect = {x, y, x+w, y+h};