summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-03-10 14:49:00 -0800
committerJamie Gennis <jgennis@google.com>2011-03-14 11:30:02 -0700
commit181f1c33c254496f2252efd41a4d1db5399c5ad2 (patch)
treec5abbef75bbc06c5a66ac5b0e9a2b9eaf768a879
parent87c3bfac18977f9c529cf9ff6dfd1f921ee9eac7 (diff)
downloadframeworks_native-181f1c33c254496f2252efd41a4d1db5399c5ad2.zip
frameworks_native-181f1c33c254496f2252efd41a4d1db5399c5ad2.tar.gz
frameworks_native-181f1c33c254496f2252efd41a4d1db5399c5ad2.tar.bz2
gl2_yuvtex: use the gralloc-provided stride.
This change fixes the gl2_yuvtex test to use the stride chosen by the gralloc implementation rather than hard-coding it. Bug: 4081948 Change-Id: If7c96a20fc3fb1df2ff25e6afaa9f34dbad2002c
-rw-r--r--opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
index 602ea1a..f0b8d12 100644
--- a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
+++ b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
@@ -186,11 +186,6 @@ const int yuvTexUsage = GraphicBuffer::USAGE_HW_TEXTURE |
GraphicBuffer::USAGE_SW_WRITE_RARELY;
const int yuvTexFormat = HAL_PIXEL_FORMAT_YV12;
const int yuvTexOffsetY = 0;
-const int yuvTexStrideY = (yuvTexWidth + 0xf) & ~0xf;
-const int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight;
-const int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
-const int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2;
-const int yuvTexStrideU = yuvTexStrideV;
const bool yuvTexSameUV = false;
static sp<GraphicBuffer> yuvTexBuffer;
static GLuint yuvTex;
@@ -200,6 +195,11 @@ bool setupYuvTexSurface(EGLDisplay dpy, EGLContext context) {
int blockHeight = yuvTexHeight > 16 ? yuvTexHeight / 16 : 1;
yuvTexBuffer = new GraphicBuffer(yuvTexWidth, yuvTexHeight, yuvTexFormat,
yuvTexUsage);
+ int yuvTexStrideY = yuvTexBuffer->getStride();
+ int yuvTexOffsetV = yuvTexStrideY * yuvTexHeight;
+ int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf;
+ int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * yuvTexHeight/2;
+ int yuvTexStrideU = yuvTexStrideV;
char* buf = NULL;
status_t err = yuvTexBuffer->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf));
if (err != 0) {