diff options
author | Yahan Zhou <yahan@google.com> | 2016-06-20 12:28:34 -0700 |
---|---|---|
committer | Yahan Zhou <yahan@google.com> | 2016-06-29 17:18:13 -0700 |
commit | 10c76828eabb3de695c5f496efaba1b91f57b04f (patch) | |
tree | 902dd92819e725b48c8c56bcee2dea5451c9833d | |
parent | 0f36b7df897a455b357e986b1ce30bf215b97276 (diff) | |
download | goldfish-opengl-10c76828eabb3de695c5f496efaba1b91f57b04f.tar.gz |
Make GL build script compatible with jb (and mr1.1, mr2)
Notice that in jb, the GL encoder is located in sdk/emulator/opengl. In
jb-mr1.1, the encoder is in development/tools/emulator/opengl.
After this patch, it should just work if you copy the opengl directory
from mnc to jb.
Change-Id: I4b6ba6daeb64315ecf72b52b142acbbccdc4dbe0
-rw-r--r-- | common.mk | 4 | ||||
-rw-r--r-- | system/egl/Android.mk | 4 | ||||
-rw-r--r-- | system/egl/egl.cpp | 6 | ||||
-rw-r--r-- | system/gralloc/gralloc.cpp | 42 |
4 files changed, 51 insertions, 5 deletions
@@ -41,6 +41,10 @@ emugl-begin-module = \ ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 23 && echo PreMarshmallow),PreMarshmallow) emugl-begin-module += $(eval include external/stlport/libstlport.mk) endif +ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 19 && echo PreKitkat),PreKitkat) + emugl-begin-module += $(eval LOCAL_MODULE_TAGS := debug) + emugl-begin-module += $(eval LOCAL_SHARED_LIBRARIES += libstlport) +endif ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 21 && echo PreLollipop),PreLollipop) emugl-begin-module += $(eval LOCAL_PRELINK_MODULE := false) diff --git a/system/egl/Android.mk b/system/egl/Android.mk index 241cefed..f7dcc70e 100644 --- a/system/egl/Android.mk +++ b/system/egl/Android.mk @@ -35,6 +35,10 @@ LOCAL_SRC_FILES := $(LOCAL_MODULE) LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl LOCAL_MODULE_CLASS := ETC +ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 19 && echo PreKitkat),PreKitkat) + LOCAL_MODULE_TAGS := debug +endif + include $(BUILD_PREBUILT) endif # TARGET_PRODUCT in 'full full_x86 full_mips sdk sdk_x86 sdk_mips google_sdk google_sdk_x86 google_sdk_mips') diff --git a/system/egl/egl.cpp b/system/egl/egl.cpp index 16182ed8..8e0268ad 100644 --- a/system/egl/egl.cpp +++ b/system/egl/egl.cpp @@ -34,6 +34,12 @@ #include <system/window.h> +#if PLATFORM_SDK_VERSION <= 16 +#define queueBuffer_DEPRECATED queueBuffer +#define dequeueBuffer_DEPRECATED dequeueBuffer +#define cancelBuffer_DEPRECATED cancelBuffer +#endif // PLATFORM_SDK_VERSION <= 16 + template<typename T> static T setErrorFunc(GLint error, T returnValue) { getEGLThreadInfo()->eglError = error; diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp index 4850c0b8..1f95ac29 100644 --- a/system/gralloc/gralloc.cpp +++ b/system/gralloc/gralloc.cpp @@ -150,14 +150,20 @@ 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)); - bool hw_cam_write = usage & GRALLOC_USAGE_HW_CAMERA_WRITE; - bool hw_cam_read = usage & GRALLOC_USAGE_HW_CAMERA_READ; +#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); +#else // PLATFORM_SDK_VERSION >= 17 + bool hw_cam_write = false; + bool hw_cam_read = false; +#endif // PLATFORM_SDK_VERSION >= 17 bool hw_vid_enc_read = usage & GRALLOC_USAGE_HW_VIDEO_ENCODER; // Keep around original requested format for later validation int frameworkFormat = format; // Pick the right concrete pixel format given the endpoints as encoded in // the usage bits. Every end-point pair needs explicit listing here. +#if PLATFORM_SDK_VERSION >= 17 if (format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) { // Camera as producer if (usage & GRALLOC_USAGE_HW_CAMERA_WRITE) { @@ -180,7 +186,9 @@ static int gralloc_alloc(alloc_device_t* dev, w, h, usage); return -EINVAL; } - } else if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) { + } +#if PLATFORM_SDK_VERSION >= 18 + else if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) { // Flexible framework-accessible YUV format; map to NV21 for now if (usage & GRALLOC_USAGE_HW_CAMERA_WRITE) { format = HAL_PIXEL_FORMAT_YCrCb_420_SP; @@ -191,6 +199,8 @@ static int gralloc_alloc(alloc_device_t* dev, w, h, usage); } } +#endif // PLATFORM_SDK_VERSION >= 18 +#endif // PLATFORM_SDK_VERSION >= 17 bool yuv_format = false; int ashmem_size = 0; @@ -235,6 +245,7 @@ static int gralloc_alloc(alloc_device_t* dev, glFormat = GL_LUMINANCE; glType = GL_UNSIGNED_SHORT; break; +#if PLATFORM_SDK_VERSION >= 17 case HAL_PIXEL_FORMAT_BLOB: bpp = 1; if (! (sw_read && hw_cam_write) ) { @@ -245,6 +256,7 @@ static int gralloc_alloc(alloc_device_t* dev, glFormat = GL_LUMINANCE; glType = GL_UNSIGNED_BYTE; break; +#endif // PLATFORM_SDK_VERSION >= 17 case HAL_PIXEL_FORMAT_YCrCb_420_SP: align = 1; bpp = 1; // per-channel bpp @@ -360,10 +372,15 @@ static int gralloc_alloc(alloc_device_t* dev, pthread_mutex_unlock(&grdev->lock); *pHandle = cb; - if (frameworkFormat == HAL_PIXEL_FORMAT_YCbCr_420_888) { + switch (frameworkFormat) { +#if PLATFORM_SDK_VERSION >= 18 + case HAL_PIXEL_FORMAT_YCbCr_420_888: *pStride = 0; - } else { + break; +#endif // PLATFORM_SDK_VERSION >= 18 + default: *pStride = stride; + break; } return 0; } @@ -628,10 +645,12 @@ static int gralloc_lock(gralloc_module_t const* module, } // validate format +#if PLATFORM_SDK_VERSION >= 18 if (cb->frameworkFormat == HAL_PIXEL_FORMAT_YCbCr_420_888) { ALOGE("gralloc_lock can't be used with YCbCr_420_888 format"); return -EINVAL; } +#endif // PLATFORM_SDK_VERSION >= 18 // Validate usage, // 1. cannot be locked for hw access @@ -642,8 +661,13 @@ static int gralloc_lock(gralloc_module_t const* module, bool hw_read = (usage & GRALLOC_USAGE_HW_TEXTURE); bool hw_write = (usage & GRALLOC_USAGE_HW_RENDER); bool hw_vid_enc_read = (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER); +#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); +#else // PLATFORM_SDK_VERSION >= 17 + bool hw_cam_write = false; + bool hw_cam_read = false; +#endif // PLATFORM_SDK_VERSION >= 17 bool sw_read_allowed = (0 != (cb->usage & GRALLOC_USAGE_SW_READ_MASK)); bool sw_write_allowed = (0 != (cb->usage & GRALLOC_USAGE_SW_WRITE_MASK)); @@ -792,6 +816,7 @@ static int gralloc_unlock(gralloc_module_t const* module, return 0; } +#if PLATFORM_SDK_VERSION >= 18 static int gralloc_lock_ycbcr(gralloc_module_t const* module, buffer_handle_t handle, int usage, int l, int t, int w, int h, @@ -895,6 +920,7 @@ static int gralloc_lock_ycbcr(gralloc_module_t const* module, return 0; } +#endif // PLATFORM_SDK_VERSION >= 18 static int gralloc_device_open(const hw_module_t* module, const char* name, @@ -1017,7 +1043,11 @@ struct private_module_t HAL_MODULE_INFO_SYM = { base: { common: { tag: HARDWARE_MODULE_TAG, +#if PLATFORM_SDK_VERSION >= 18 module_api_version: GRALLOC_MODULE_API_VERSION_0_2, +#else // PLATFORM_SDK_VERSION >= 18 + module_api_version: 1, +#endif // PLATFORM_SDK_VERSION >= 18 hal_api_version: 0, id: GRALLOC_HARDWARE_MODULE_ID, name: "Graphics Memory Allocator Module", @@ -1031,7 +1061,9 @@ struct private_module_t HAL_MODULE_INFO_SYM = { lock: gralloc_lock, unlock: gralloc_unlock, perform: NULL, +#if PLATFORM_SDK_VERSION >= 18 lock_ycbcr: gralloc_lock_ycbcr, +#endif // PLATFORM_SDK_VERSION >= 18 } }; |