From 2d824c62e756ac086de7bf0f648e990257115099 Mon Sep 17 00:00:00 2001 From: Jacky Romano Date: Sun, 27 Mar 2011 17:57:51 +0200 Subject: [PATCH] Android emulator opengl - unit testing render control api This adds minimal rendering control api codec that is used by opengl codec unit tests. The api is used to pass messages regarding resource creation (surfaces, opengl context) and swapbuffers notifications. The actual encoder and decoder code is generated using 'emugen' Change-Id: Ia9b74ae755d032a9b02fdc5f85575d4cd8ada326 --- .../tests/ut_rendercontrol_dec/Android.mk | 34 ++++++++++++++++++ .../tests/ut_rendercontrol_enc/Android.mk | 36 +++++++++++++++++++ .../ut_rendercontrol.attrib | 4 +++ .../ut_rendercontrol_enc/ut_rendercontrol.in | 11 ++++++ .../ut_rendercontrol.types | 2 ++ .../ut_rendercontrol_types.h | 17 +++++++++ 6 files changed, 104 insertions(+) create mode 100644 tools/emulator/opengl/tests/ut_rendercontrol_dec/Android.mk create mode 100644 tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk create mode 100644 tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib create mode 100644 tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in create mode 100644 tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types create mode 100644 tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_dec/Android.mk b/tools/emulator/opengl/tests/ut_rendercontrol_dec/Android.mk new file mode 100644 index 000000000..2ae22d340 --- /dev/null +++ b/tools/emulator/opengl/tests/ut_rendercontrol_dec/Android.mk @@ -0,0 +1,34 @@ + +LOCAL_PATH := $(call my-dir) + +### ut_rendercontrol Decoder ########################################### +include $(CLEAR_VARS) + +emulatorOpengl := $(LOCAL_PATH)/../.. +EMUGEN := $(HOST_OUT_EXECUTABLES)/emugen + +LOCAL_IS_HOST_MODULE := true +LOCAL_MODULE_CLASS := SHARED_LIBRARIES +LOCAL_MODULE_TAGS := debug +LOCAL_MODULE := libut_rendercontrol_dec +LOCAL_SRC_FILES := +#LOCAL_CFLAGS += -DDEBUG_PRINTOUT -O0 -g +intermediates := $(local-intermediates-dir) + +LOCAL_STATIC_LIBRARIES := \ + libOpenglCodecCommon \ + liblog +LOCAL_C_INCLUDES += $(emulatorOpengl)/system/OpenglCodecCommon $(emulatorOpengl)/tests/ut_rendercontrol_enc + +#we use only *_dec.h as a sentinel for the other generated headers +GEN := $(intermediates)/ut_rendercontrol_dec.cpp $(intermediates)/ut_rendercontrol_dec.h +$(GEN): PRIVATE_PATH := $(LOCAL_PATH) +$(GEN): PRIVATE_CUSTOM_TOOL := $(EMUGEN) -D $(intermediates) -i $(emulatorOpengl)/tests/ut_rendercontrol_enc ut_rendercontrol +$(GEN): $(EMUGEN) \ + $(emulatorOpengl)/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib \ + $(emulatorOpengl)/tests/ut_rendercontrol_enc/ut_rendercontrol.in \ + $(emulatorOpengl)/tests/ut_rendercontrol_enc/ut_rendercontrol.types + $(transform-generated-source) + +LOCAL_GENERATED_SOURCES += $(GEN) +include $(BUILD_HOST_SHARED_LIBRARY) diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk b/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk new file mode 100644 index 000000000..1b5d4329d --- /dev/null +++ b/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk @@ -0,0 +1,36 @@ +LOCAL_PATH := $(call my-dir) + +emulatorOpengl := $(LOCAL_PATH)/../.. +#### ut_rendercontrol #### +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := +LOCAL_MODULE_TAGS := debug +LOCAL_MODULE := libut_rendercontrol_enc +LOCAL_PRELINK_MODULE := false +LOCAL_MODULE_CLASS := SHARED_LIBRARIES + +ut_intermediates := $(local-intermediates-dir) + +LOCAL_C_INCLUDES += $(emulatorOpengl)/system/OpenglCodecCommon + +LOCAL_STATIC_LIBRARIES := \ + libOpenglCodecCommon +LOCAL_SHARED_LIBRARIES := libcutils + +UT_GEN := \ + $(ut_intermediates)/ut_rendercontrol_enc.cpp \ + $(ut_intermediates)/ut_rendercontrol_enc.h + +$(UT_GEN) : PRIVATE_PATH = $(LOCAL_PATH) +$(UT_GEN) : PRIVATE_CUSTOM_TOOL := \ + $(EMUGEN) -i $(PRIVATE_PATH) -E $(ut_intermediates) ut_rendercontrol +$(UT_GEN) : $(EMUGEN) \ + $(LOCAL_PATH)/ut_rendercontrol.in \ + $(LOCAL_PATH)/ut_rendercontrol.attrib \ + $(LOCAL_PATH)/ut_rendercontrol.types + $(transform-generated-source) + +LOCAL_GENERATED_SOURCES += $(UT_GEN) +include $(BUILD_SHARED_LIBRARY) + diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib new file mode 100644 index 000000000..c47a9f99f --- /dev/null +++ b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.attrib @@ -0,0 +1,4 @@ +GLOBAL + base_opcode 10000 + encoder_headers + diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in new file mode 100644 index 000000000..856fed621 --- /dev/null +++ b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.in @@ -0,0 +1,11 @@ +GL_ENTRY(int, createContext, uint32_t pid, uint32_t handle, uint32_t shareCtx) +GL_ENTRY(int, createSurface, uint32_t pid, uint32_t handle) +GL_ENTRY(int, makeCurrentContext, uint32_t pid, uint32_t drawSurface, uint32_t readSurface, uint32_t ctxHandle) +GL_ENTRY(void, swapBuffers, uint32_t pid, uint32_t surface) +GL_ENTRY(int, destroyContext, uint32_t pid, uint32_t handle) +GL_ENTRY(int, destroySurface, uint32_t pid, uint32_t handle) + + + + + diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types new file mode 100644 index 000000000..eb4dd1b05 --- /dev/null +++ b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol.types @@ -0,0 +1,2 @@ +uint32_t 32 0x%08x + diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h new file mode 100644 index 000000000..9b7864dc1 --- /dev/null +++ b/tools/emulator/opengl/tests/ut_rendercontrol_enc/ut_rendercontrol_types.h @@ -0,0 +1,17 @@ +/* +* Copyright (C) 2011 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include