Skip to content
Snippets Groups Projects
Commit f7f324ef authored by Android Build Role Account android-build-prod's avatar Android Build Role Account android-build-prod
Browse files

Snap for 5622687 from 96bd76d4 to q-keystone-qcom-release

Change-Id: I5266f1ec730ace09c6395e7f619f569845137fbe
parents 8592345e 96bd76d4
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,6 @@ enum EmulatorFrameworkFormat {
FRAMEWORK_FORMAT_GL_COMPATIBLE = 0,
FRAMEWORK_FORMAT_YV12 = 1,
FRAMEWORK_FORMAT_YUV_420_888 = 2, // (Y+)(U+)(V+)
FRAMEWORK_FORMAT_YUV_420_888_INTERLEAVED = 3, // (Y+)(UV)+
};
//
......
......
......@@ -920,7 +920,11 @@ __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname)
const char* eglQueryString(EGLDisplay dpy, EGLint name)
{
// EGL_BAD_DISPLAY is generated if display is not an EGL display connection, unless display is
// EGL_NO_DISPLAY and name is EGL_EXTENSIONS.
if (dpy || name != EGL_EXTENSIONS) {
VALIDATE_DISPLAY_INIT(dpy, NULL);
}
return s_display.queryString(name);
}
......
......
......@@ -479,6 +479,7 @@ static int gralloc_alloc(alloc_device_t* dev,
bool sw_write = (0 != (usage & GRALLOC_USAGE_SW_WRITE_MASK));
bool hw_write = (usage & GRALLOC_USAGE_HW_RENDER);
bool sw_read = (0 != (usage & GRALLOC_USAGE_SW_READ_MASK));
const bool hw_texture = usage & GRALLOC_USAGE_HW_TEXTURE;
#if PLATFORM_SDK_VERSION >= 17
bool hw_cam_write = (usage & GRALLOC_USAGE_HW_CAMERA_WRITE);
bool hw_cam_read = (usage & GRALLOC_USAGE_HW_CAMERA_READ);
......@@ -541,6 +542,15 @@ static int gralloc_alloc(alloc_device_t* dev,
glFormat = GL_RGBA;
glType = GL_UNSIGNED_BYTE;
break;
case HAL_PIXEL_FORMAT_RGB_888:
if (hw_texture) {
return -EINVAL; // we dont support RGB_888 for HW textures
} else {
bpp = 3;
glFormat = GL_RGB;
glType = GL_UNSIGNED_BYTE;
break;
}
case HAL_PIXEL_FORMAT_RGB_565:
bpp = 2;
// Workaround: distinguish vs the RGB8/RGBA8
......@@ -613,13 +623,7 @@ static int gralloc_alloc(alloc_device_t* dev,
// We are going to use RGB888 on the host
glFormat = GL_RGB;
glType = GL_UNSIGNED_BYTE;
if (usage & (GRALLOC_USAGE_HW_CAMERA_READ | GRALLOC_USAGE_HW_CAMERA_WRITE)) {
// EmulatedFakeCamera3.cpp assumes it is NV21
selectedEmuFrameworkFormat = FRAMEWORK_FORMAT_YUV_420_888_INTERLEAVED;
} else {
selectedEmuFrameworkFormat = FRAMEWORK_FORMAT_YUV_420_888;
}
break;
default:
ALOGE("gralloc_alloc: Unknown format %d", format);
......@@ -1195,7 +1199,9 @@ static int gralloc_lock(gralloc_module_t const* module,
return -EBUSY;
}
if (sw_read) {
// camera delivers bits to the buffer directly and does not require
// an explicit read, it also writes in YUV_420 (interleaved)
if (sw_read & !(usage & GRALLOC_USAGE_HW_CAMERA_MASK)) {
void* rgb_addr = cpu_addr;
char* tmpBuf = 0;
if (cb->frameworkFormat == HAL_PIXEL_FORMAT_YV12 ||
......@@ -1319,8 +1325,10 @@ static int gralloc_lock_ycbcr(gralloc_module_t const* module,
return -EINVAL;
}
usage |= (cb->usage & GRALLOC_USAGE_HW_CAMERA_MASK);
void *vaddr;
int ret = gralloc_lock(module, handle, usage | GRALLOC_USAGE_SW_WRITE_MASK, l, t, w, h, &vaddr);
int ret = gralloc_lock(module, handle, usage, l, t, w, h, &vaddr);
if (ret) {
return ret;
}
......@@ -1357,7 +1365,7 @@ static int gralloc_lock_ycbcr(gralloc_module_t const* module,
cStep = 1;
break;
case HAL_PIXEL_FORMAT_YCbCr_420_888:
if (cb->emuFrameworkFormat == FRAMEWORK_FORMAT_YUV_420_888_INTERLEAVED) {
if (usage & GRALLOC_USAGE_HW_CAMERA_MASK) {
yStride = cb->width;
cStride = cb->width;
yOffset = 0;
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment